-
Notifications
You must be signed in to change notification settings - Fork 114
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
Improving performance for Copy
keys and values
#12
Comments
If there were a good way to make the |
I'd like to think about this too. Could you give an example of the ergonomics provided by the I'm also curious as to why accessors such as Thanks, and sorry if I'm butting in where I don't belong. |
Some might be for historical reasons, I distinctly recall moments in the early days when I just couldn't figure out how to return a reference. Right now it probably ought to be returning |
Thanks for explaining. I agree it's unlikely to need to clone the reference. I figured I was thinking that it would also be possible to get a reference to the tail without bumping a refcount, at the cost of a slight increase in overall complexity. But it would make it easy to do arbitrary manual traversals without any refcount changes, which is nice. I can write it up if you like. |
The I'd love to see your take on it, but it may need to be merged as part of a bigger overhaul... |
I see. And is the assumption also that you need to copy elements for some of the operations? I wonder what would happen if you just placed a I attempted to work up my take, and it didn't work as expected, but I've created an issue detailing what I did manage to do. |
Update on this: I'm currently rewriting |
This is good to hear—I think the There’s an additional thing I investigated that might interest you. For methods that insert an element, I had them take |
@tov I was using |
I wrote a few simple benchmarks to determine what, if anything, might be gained by storing keys and values directly in
OrdMap
rather than wrapping them inArc
s:https://github.com/dicej/ordmap_performance/blob/master/src/lib.rs
(note that I had to hack the im-rs lib.rs to make the
nodes
module public in order to make the above work)Here are the results on my machine:
Considering that performance is roughly doubled by removing the
Arc
s, would it be appropriate to modify the APIs so that theArc
wrappers are optional?The text was updated successfully, but these errors were encountered: