-
Notifications
You must be signed in to change notification settings - Fork 30
Conversation
Can you try changing your benchmark so that it uses larger maps (say, up to 10k elements)? I think |
@hdgarrood Good idea. Here is a plot going out to 10k elements: It looks like In case you want a sorted array, rather than a sorted list, the fastest way is still through (Benchmark code is here.) But to be clear – my intent with this PR is to establish a clear API with a |
I noticed that some uses of |
Ok cool, good to know. I realise what the goal of this PR is, I just wanted to check the assumption it was based on :) If Also have you tried to come up with an efficient way of implementing this in terms of Either way though I think we should deprecate |
@hdgarrood Your question about So here's what I've done:
Please take a look. 😃 |
👍 Looks good to me, and deprecating |
Looks great, I just have a few minor suggestions:
|
All those points sound good. I'll make the changes. Small question: you occasionally say |
This looks great, thanks very much! |
Yeah I'm not particularly fussed about which way around it is, I think it probably does make sense to mirror Haskell if that's the way Haskell does it. |
The current version of
toList
has the nice undocumented property that it returns key/value pairs in ascending order. Per recent changes totoUnfoldable
(#76), I can imagine this implementation being changed in the future, breaking this property. So here's a synonym which assures the user that they will get their key/value pairs in ascending order, together with a test.In case you were curious: I adapted @sammthomson's benchmark from #76 to a couple different ways to compute sorted & unsorted collections from maps:
This suggests that
toList
is a faster way to get a sorted collection than sorting the output oftoUnfoldable
(with list or array output), but it is a slower way to get an unsorted list than runningtoUnfoldable
with list output.