From 251da60e0e4d7ba8abfee14b4de859e0d1d9fea8 Mon Sep 17 00:00:00 2001 From: Liubov Dmitrieva Date: Thu, 30 Jan 2025 08:25:17 -0800 Subject: [PATCH] improve perf of eden clone Summary: improve perf of eden clone Eden clone takes around 2 seconds, and it includes calling `hg config --local` command 2 times in row where each call takes ~300 ms. So, this diff would make the config setup into 1 `hg config` call saving us 300 ms of time, wich is a good win for SCM on RE project where we aim to minimise latency. Reviewed By: muirdm Differential Revision: D68893490 fbshipit-source-id: 19dc9beacb1ac127de1ba15fbe751541a2d0626d --- eden/fs/cli/config.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/eden/fs/cli/config.py b/eden/fs/cli/config.py index 571a604d528ed..e50d1e5c091e5 100644 --- a/eden/fs/cli/config.py +++ b/eden/fs/cli/config.py @@ -816,17 +816,18 @@ def _post_clone_checkout_setup( env=env, ) - configs = dict() + configs = {} if checkout.get_config().scm_type == "filteredhg": configs["extensions.edensparse"] = "" configs["extensions.sparse"] = "!" - for k, v in configs.items(): + if len(configs) > 0: + args = [f"{k}={v}" for k, v in configs.items()] subprocess.check_call( [ os.environ.get("EDEN_HG_BINARY", "hg"), "config", "--local", - f"{k}={v}", + *args, "-R", str(checkout.path), ],