-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add benchmarks for nubEq, union, intersect, and difference #206
Conversation
Benchmark results:
|
Since these functions only behave interestingly in arrays which have some duplicates, we should probably ensure that the arrays we're benchmarking with also include some duplicates. If we only test with arrays in which every element is unique, and there's a performance issue that makes these functions perform especially poorly on arrays with lots of duplicates, we won't catch it with these benchmarks. |
I've updated the arrays we test to have half of their elements be unique and the other half to have duplicates based on the number (e.g. |
The array creation in this PR currently involves a lot of magic numbers that are going to be tricky to edit if we want to modify sizes. And it would be good to do some more shuffling of the data. Here's another way to generate the input data: Unfortunately, this uses quickcheck's
Edit: On second thought, maybe just reversing the first half of each input array is a reasonable enough approximation of a shuffle for most sorting algorithms to deal with. Edit2: Here's a version that shuffles by interleaving the first half of the array with the reversed other half. https://github.com/milesfrain/bench-array-demo/blob/no-quickcheck/test/Main.purs |
Since there's no rush on #203, it might make sense to tackle things in this order:
|
No description provided.