From a864ab9888fec9bd01c27aaa80be876ec762e9b3 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Mon, 5 Aug 2024 16:28:44 -0300 Subject: [PATCH] feat: Add a dictionary to cache abs_root_path results --- aider/coders/base_coder.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index 26132a5a3..c2276c266 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -71,6 +71,7 @@ class Coder: test_outcome = None multi_response_content = "" rejected_urls = set() + abs_root_path_cache = {} @classmethod def create( @@ -397,8 +398,10 @@ class Coder: return True def abs_root_path(self, path): - res = Path(self.root) / path - return utils.safe_abs_path(res) + if path not in self.abs_root_path_cache: + res = Path(self.root) / path + self.abs_root_path_cache[path] = utils.safe_abs_path(res) + return self.abs_root_path_cache[path] fences = [ ("``" + "`", "``" + "`"),