From 6690b13a9763419fb839dfb56eca753fb4a0ca2a Mon Sep 17 00:00:00 2001 From: Sander van Beek Date: Wed, 25 Feb 2026 10:47:06 +0100 Subject: [PATCH 1/3] Added cache to same_file check This saves about 8 minutes (11m 0.14s -> 2m 55.07) in my test project of ~600 files. --- packages/core/src/robotcode/core/utils/path.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/core/src/robotcode/core/utils/path.py b/packages/core/src/robotcode/core/utils/path.py index 35f181453..9a44045c0 100644 --- a/packages/core/src/robotcode/core/utils/path.py +++ b/packages/core/src/robotcode/core/utils/path.py @@ -1,3 +1,4 @@ +import functools import os import re import sys @@ -61,6 +62,7 @@ def normalized_path_full(path: Union[str, "os.PathLike[str]"]) -> Path: return Path(*parents) +@functools.cache def same_file(path1: Union[str, "os.PathLike[str]", Path], path2: Union[str, "os.PathLike[str]", Path]) -> bool: try: return os.path.samefile(path1, path2) From f3a3f0cd6d3da5ef37328f973c55f4af9607bc5a Mon Sep 17 00:00:00 2001 From: Sander van Beek Date: Wed, 25 Feb 2026 14:49:52 +0100 Subject: [PATCH 2/3] Added cache size limit --- packages/core/src/robotcode/core/utils/path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/robotcode/core/utils/path.py b/packages/core/src/robotcode/core/utils/path.py index 9a44045c0..c9394d53c 100644 --- a/packages/core/src/robotcode/core/utils/path.py +++ b/packages/core/src/robotcode/core/utils/path.py @@ -62,7 +62,7 @@ def normalized_path_full(path: Union[str, "os.PathLike[str]"]) -> Path: return Path(*parents) -@functools.cache +@functools.lru_cache(maxsize=100_000) def same_file(path1: Union[str, "os.PathLike[str]", Path], path2: Union[str, "os.PathLike[str]", Path]) -> bool: try: return os.path.samefile(path1, path2) From 8194326cbd09c68567e7cc067a7712e59d6657e7 Mon Sep 17 00:00:00 2001 From: Sander van Beek Date: Wed, 25 Feb 2026 14:51:00 +0100 Subject: [PATCH 3/3] Increased cache size limit for `search_variable` This saves about 37 seconds (2m 55.07 -> 2m 18.07) in my test project of ~600 files. --- packages/robot/src/robotcode/robot/utils/variables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/robot/src/robotcode/robot/utils/variables.py b/packages/robot/src/robotcode/robot/utils/variables.py index 877d6612b..9e4076f02 100644 --- a/packages/robot/src/robotcode/robot/utils/variables.py +++ b/packages/robot/src/robotcode/robot/utils/variables.py @@ -215,7 +215,7 @@ def is_variable(string: str, identifiers: str = "$@&") -> bool: return cast(bool, robot_is_variable(string, identifiers)) -@functools.lru_cache(maxsize=1024) +@functools.lru_cache(maxsize=100_000) def search_variable( string: str, identifiers: str = "$@&%*", parse_type: bool = False, ignore_errors: bool = False ) -> VariableMatcher: