-
Notifications
You must be signed in to change notification settings - Fork 38
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 LittleDict #19
Add LittleDict #19
Conversation
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.
I would approve having this here.
@timholy do you think I should abstract the |
Ok, I am done. The tests on the Frozen LittleDict are rather simple, but I think it is enough. I think there is a bit more that can be done to make FrozenLittleDicts a bit faster, |
I microoptimized I don't care so much about the performance of |
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.
Looks good to me. Left some minor comments.
Once the length check is in or argued to be unnecessary, I'm good with this, no need for further review. |
Length check addded, I got enthused and added better use of the type system to ensure we never tried to mutate unmutable things. The tests don't test the unhappy path very well. |
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.
One small change needed for tests to pass on 32-bit systems.
Ready for merge |
This PR adds a new type
LittleDict
.It is optized for small numbers of elements
My timing on a earlier version* had it hitting parity with
OrderedDict
forSymbol
keys, at 30 elements when backed with aVector
or 50 elements when backed with aTuple
.I would like to put it in OrderedCollections.jl because
OrderedDict
right now, would be better off usingLittleDict
. (Basically all my . previous uses. Though I may be a nonrepresentative sample.)TODO is tests, and a bit more API, esp constructors.
But I will let the tests driive those.
I want to basically reuse the OrderedDict tests, (except the ones that involve 10,000 elements)
but I am undecided as to if that should be via copy-paste,
or via adding abstraction to the current testset.