Cache parsed package info in nimblemeta.json to avoid re-parsing inst…#1718
Open
bung87 wants to merge 2 commits into
Open
Cache parsed package info in nimblemeta.json to avoid re-parsing inst…#1718bung87 wants to merge 2 commits into
bung87 wants to merge 2 commits into
Conversation
…alled packages This fixes the performance issue where nimble reevaluates every package in the nimble directory on each command, causing slow builds when the global nimble dir has many packages (nim-lang#1331). Changes: - Extend PackageMetaData with requires, features, srcDir, paths, preHooks, postHooks, and nestedRequires fields - Save parsed info to nimblemeta.json during installation - Load cached info in getInstalledPackageMin to skip re-parsing - Skip toRequiresInfo for installed packages that have cached data - Add backward-compatible initFromJson for PackageMetaData
…tolerance - install.nim: Use serializeRequires that matches toJsonHook behavior: * verAny: just name (e.g. "file://../depfile") * verSpecial: name + ver without space (e.g. "nim#head") * others: name + space + ver (e.g. "nim >= 1.2") This fixes the round-trip parsing issue where produced "name@ver" format that parseRequires could not handle. - packageinfo.nim: Wrap parseRequires in try/except so corrupted or old-format cache data doesn't crash nimble. Falls back to normal parsing when cache deserialization fails. - packagemetadatafile.nim: Restore custom initFromJson for PackageMetaData to tolerate missing fields in old nimblemeta.json files, preserving backward compatibility with packages installed by older nimble versions.
Collaborator
|
The declarative parsing shouldnt take enough time to worth to cache it. Did you benchmark it? |
Contributor
Author
|
I didn't get correct performance result due to something wrong when running, but I have 200+ packages installed, so even the declarative parsing is fast, I still dont wanna waste time |
Collaborator
|
Well, you should use |
Contributor
Author
|
I only use couple times due to network condition, most times use the global mode. |
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.
…alled packages
This fixes the performance issue where nimble reevaluates every package in the nimble directory on each command, causing slow builds when the global nimble dir has many packages (#1331). same to #1486
Changes: