Add in-memory caching for directory reads#613
Open
zapdos26 wants to merge 3 commits intoenvmodules:mainfrom
Open
Add in-memory caching for directory reads#613zapdos26 wants to merge 3 commits intoenvmodules:mainfrom
zapdos26 wants to merge 3 commits intoenvmodules:mainfrom
Conversation
Wrap getFilesInDirectory (C extension or Tcl fallback) with an in-memory cache keyed by directory path and fetch_dotversion flag. The cache lives for the duration of a single modulecmd process, avoiding redundant directory reads when the same directory is accessed multiple times during module resolution or overlapping search traversals. This reduces NFS round-trips on systems with thousands of modulefiles across deep directory structures. Signed-off-by: zapdos26 <zapdoskid@gmail.com>
Verify that the in-memory getFilesInDirectory cache returns correct results on repeated queries within a single invocation. Tests exercise cache population and cache hit paths. Signed-off-by: zapdos26 <zapdoskid@gmail.com>
…t env(TESTSUITE_MCOOKIE_CHECK) evalhide Signed-off-by: zapdos26 <zapdoskid@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces an in-memory cache for directory reads in the
getFilesInDirectoryfunction to optimize performance by avoiding redundant reads during a single module command invocation. Additionally, a new test has been added to verify that the cache returns consistent results for repeated queries.Caching improvements:
getFilesInDirectoryfunction intcl/main.tcl.in, wrapping the original implementation and storing results for repeated directory queries within a single invocation.Testing enhancements:
testsuite/modules.90-avail/025-memcache.expto confirm that consecutiveavailqueries on the same module path return consistent results, validating the effectiveness of the cache.