Commit Graph
2 Commits
Author SHA1 Message Date
Pini Vaknin 16378b4846 perf(resolution): skip os.getcwd() in the path-memo key for absolute paths
_source_key and _resolve_cached key their lru_cache on the path and the
cwd, and call os.getcwd() on every lookup, hit or miss. On a 900-file
repo an extract makes about 215k of those calls. os.getcwd() is a
syscall that costs 30 to 40us on macOS, so building the key cost more
than the resolution the memo saved.

An absolute path resolves the same from any cwd, so it now keys with an
empty cwd. A relative path still keys on the cwd, so a chdir still misses
the cache. Path.is_absolute() applies host rules, which is what local
resolution needs: a driveless path on Windows depends on the drive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 2228f80804)
2026-10-10 22:11:03 +01:00
abhay-codes07 d7de19d47d perf(resolution): memoize source-key resolution in the id-disambiguation pass
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JJbLfztSxm2tH5cJwBbe9q
(cherry picked from commit 2adfa810c9)
2026-09-11 22:46:36 +01:00