-
Notifications
You must be signed in to change notification settings - Fork 49
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
Share BinEntry::Moved across all moved bins in a table #56
Conversation
Codecov Report
|
6b6da65
to
9793d31
Compare
Here's a question: do we even need to store the address inside of |
Ah, the sanitizers fail due to a test case which manually constructs |
Assuming the With regard to different |
Oh, you could still also share the Right, I agree with you that that makes sense, but the Java version very deliberately chooses to store the pointer in every |
I think I found out why they did it. The reason I think is that |
Ah, I see, interesting.. Or to pass |
Okay so I did that (spending half the time rewriting test cases that got broken by all the moving around 😅 ). Performance is comparable shared Anyways, since the tests causing the asan fail were among the ones I touched anyways, here's hoping I didn't miss anything and the sanitizers stop complaining :P |
7ad0857
to
00ed07e
Compare
Nice, fixed the tests. Please review again. Also, if we stick with some form of this change, the question about the checks in |
00ed07e
to
582611e
Compare
Oh, yeah, I didn't expect that removing the pointer would change performance really, it's just one fewer "weird" thing in the code :) |
Hmm, okay, stepping out from the sub-comments a bit, I think the loop should be replaced with just a swap of EDIT: I think this is what you originally proposed, just want to make sure I understand it right. We might not need to drop |
582611e
to
d2fa9b1
Compare
assert tables match when a shared Moved is used
d2fa9b1
to
d59a84a
Compare
It was, except I didn't know about the possibility of using |
This is looking really good now — just a few more comments 😅 |
make BinEntry::Moved a true marker variant next pointer is now lifted up to table level and shared across all bins help_transfer computes next_table from the current table
d59a84a
to
f6f5208
Compare
Beautiful, thank you! 🎉 |
This originates from #50 and tries to achieve performance improvements by instantiating only one
BinEntry::Moved
per table, as for all moved bins inside a table theMoved
points to the same next table. In particular, this tries to reduce the amount of allocations ofMoved
byOwned::new
, onlyload
ing more shared pointers to theMoved
instead.This is submitted as a draft for the following reasons:
the history for this contains the changes in Use(Edit: changed that)clear()
in benchmarks #55, which is still pending approvalTable::drop
contains a section which iterates through all bins, dropsMoved
entries and checks that none of the bins are non-empty. With these changes, theMoved
is only dropped once (and turning all shared pointers to itinto_owned
would be incorrect), so this loop is not technically necessary any longer. I left the check againstMoved
in for now, but would like to discuss the possibility of removing it and relying on the other parts of the map implementation to uphold the invariant of all bins being empty at this point.I will add performance results to #50 as soon as I am done submitting this.