-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slow lockfile gen #1261
Slow lockfile gen #1261
Conversation
@finnhodgkin I am interested in merging this, perf is something we care about a lot. You can go ahead with the cleanup and we can get this merged. But I can also review before that if that's something you'd like. |
In my head I was going to clean this up straight after pushing but got distracted. I'll sort it tomorrow. The thing I could do with a hand on is the sqlite query. I think it's safe to leave un-paramatised because it's called with
Was possibly just calling it incorrectly, will test - WiseLibs/better-sqlite3#1109 Went with WiseLibs/better-sqlite3#283 (comment) in the end which seems to work. |
@f-f should be good to review now as long as CI goes smoothly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great now 👏
We should adjust a few comments and names, but it's otherwise good to go
src/Spago/Registry.purs
Outdated
@@ -62,6 +63,7 @@ type RegistryEnv a = Record (RegistryEnvRow a) | |||
type RegistryFunctions = | |||
{ getManifestFromIndex :: PackageName -> Version -> Spago (LogEnv ()) (Maybe Manifest) | |||
, getMetadata :: PackageName -> Spago (LogEnv ()) (Either String Metadata) | |||
, getMetadatas :: Array PackageName -> Spago (LogEnv ()) (Either String (Map PackageName Metadata)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any point in keeping getMetadata
as well now that we have getMetadatas
?
As an aside, data
is a latin word that's already plural, so adding the s
suffix doesn't feel right. How about renaming to getMetadataForPackages
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The singular version is still used in Command.Repl, Command.Publish and Command.Registry so I just left it alone.
Thanks, will swap to suggested name, had the same thought re datas but wasn't sure about a good replacement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The singular version is still used in Command.Repl, Command.Publish and Command.Registry so I just left it alone.
Sure, but we can now call the new implementation passing in a singleton array [packageName]
? Having two implementations for the same thing guarantees that they will go out of sync in the future, so I'd rather remove the singular version now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sure. Like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could replace the function entirely but it feels useful being able to look up a single package without Map.lookup
ing the results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that makes sense, thanks!
@finnhodgkin could you merge with latest? |
Thank you! |
Description of the change
#1262
Lockfile generation on my large work project takes over 3 minutes.
Adding a bunch of memoisation and combining many individual sqlite queries into one gets this down to 1.5 seconds.
Checklist:
README
P.S.: the above checks are not compulsory to get a change merged, so you may skip them. However, taking care of them will result in less work for the maintainers and will be much appreciated 😊