-
Notifications
You must be signed in to change notification settings - Fork 30
Improve performance of weeder when type-class-roots = false is set. #172
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
Conversation
Wow, what an incredible speed up! I'll take a look! @ryndubei could you also have a look if you have time? |
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.
Thanks! I don't have a large enough project on hand at the moment that I can quickly test the performance with, but the changes look good to me. I only have a few minor, mostly-style-related comments.
For analysing evidence uses we collect evidence uses in, ```haskell requestedEvidence :: Map Declaration (Set Name) ``` In analyseEvidenceUses, we loop over all the names in all the sets of the map, to construct dependency graph after calling `getEvidenceTree` on the name. However, these names in sets across different declarations are duplicated a lot. In one example in a repo at work, we have 16961625 names in which only 200330 are unique. So now, we instead pre-construct an evidence trees map `Map Name [Declaration]` for all the unique name and perform a lookup in this map to construct the graph. In a private repo, the times before this change and after ``` ❯ find . -name '*.hie' | wc -l 1097 ❯ time result/bin/weeder # weeder from master real 5m53.707s user 5m50.350s sys 0m2.206s ❯ time result/bin/weeder # weeder from this branch real 0m34.008s user 0m31.716s sys 0m2.196s ```
@ryndubei I addressed all of your comments one minor thing I have noticed is there seems to be a slight performance loss with the usage of Since the performance impact only seems to be at most 1-2 seconds, I think we can prefer code clarity |
also, why don't we link the executable with |
Before...
After
Hard to argue with that! Thanks for you hard work, @pranaysashank! |
For analysing evidence uses we collect evidence uses in,
In
analyseEvidenceUses
, we loop over all the names in all the sets of the map, to construct dependency graph after callinggetEvidenceTree
on the name. However, these names in sets across different declarations are duplicated a lot. In one example in a repo at work, we have16961625
names in which only200330
are unique. So now, we instead pre-construct an evidence trees mapMap Name [Declaration]
for all the unique name and perform a lookup in this map to construct the graph.In a private repo, the times before this change and after
I have a failing test in
./test/Spec/ModuleRoot
, but this is failing on master as well.