-
Notifications
You must be signed in to change notification settings - Fork 1
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
Use Set for nub ord #1
Conversation
@MonoidMusician, Thanks for the help with this. I'll definitely incorporate your set-based approach for lazy lists. Here's some initial benchmarking results on each branch: Turns out neither version is stack safe. The original sorting approach fails at 100k elements, and this set approach fails at 10k elements. The sorting version is also noticeably faster after 100 elements. These results are highly-dependent on the number of duplicates though, and I suspect the set-based algo will outperform sorting if there's a high percentage of duplicates. We can more carefully control the distribution of duplicates with something like arrayGen (proposed in another benchmarking PR). My next step is going to be making the sorting version stack safe. Edit: I wonder if there's any value in writing a more optimized variant of List.sortBy (e.g. |
Working on stack safety in this other branch. #2 Edit: Turns out this is a problem with |
Ah yeah, I’m glad you’re benchmarking it. I realized it wasn’t stack safe, but I saw that It’s interesting that the sorting would be faster, it seems like that does a lot more work but idk. |
I incorporated your changes into purescript#179. |
I haven't tested it yet but I'm pretty sure it works … I made separate commits to make it easy to follow but feel free to squash of course!