Faster warnDuplicateRefs#3899
Conversation
|
There are a few other Since these don't preserve all duplicates, I'm wondering if this would also fix #3884 |
|
Is Also, it seems like the code for the purescript/src/Language/PureScript/AST/Declarations.hs Lines 335 to 358 in 9cad73e |
kritzcreek
left a comment
There was a problem hiding this comment.
Thanks, this looks great. I noticed this is pointed at the 0.13.x release branch. Shouldn't we be commiting to master first and then cherry picking the changes we'd like to release onto the release branches, @hdgarrood ?
There was a problem hiding this comment.
I still think this can just be (\x -> length x > 1), but I'll leave that to your judgement.
There was a problem hiding this comment.
Going with the "guaranteed fast" over the "likely fast" strategy, even if it's a few more lines of code.
Yes please - there may not be another 0.13.x release, but even if we do make an 0.13.9 release we will want any changes in master first. @milesfrain I like the If you'd like to rewrite the
If you'd like to do |
|
I edited the above comment a few times, sorry. I'm done now :) |
d478394 to
32ad517
Compare
|
Rebased to master.
I'll make a separate PR to clean-up ordering code that includes:
|
|
Looks like CI is failing because a compiler warning has changed. Could you run the tests with —accept to see if that fixes it? |
What command is that? |
|
|
|
Since preserving all duplicates is not the core focus of this PR, I just removed that change and left a note about it to be tackled in another issue. Some tests still needed to be modified to account for minor reordering of warnings though. I assume that's because the list is actually sorted with this change. |
|
Yeah, I think having the same warnings in a different order is fine. Thanks very much! Also, from earlier,
Yes, that sounds like a good idea to me. |
See the "Reducing incremental rebuild time with large file dependency" thread for context.
Looks like the issue is here:
purescript/src/Language/PureScript/Sugar/Names/Common.hs
Line 27 in c044d69
Profiling shows warnDuplicateRefs takes 46% of the build time - the majority of it spent making 96 million calls to ==.
I replaced the slow
\\ nubpattern with a fasteronlyDuplicatesfunction. I'm surprised this doesn't exist already in some library.The
onlyDuplicatesfunction also seems more correct than\\ nubin that it doesn't arbitrarily discard one of every duplicate. For example:For my use case with a large
Tailwind.pursfile, overall compilation times are reduced from 3.1 to 1.2 seconds and the share of time spent inwarnDuplicateRefsis reduced from 46% to 0.5%.Here are more detailed performance notes:
Original
This PR