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
Improve (and test) memoryview reference counting #5510
Conversation
1. Avoid needing an indirection to align the atomic types. They should be aligned anyway, and this causes a notable slow-down. 2. Don't use "volatile" typedef - volatile doesn't guarantee anything about atomicity and isn't needed here. 3. Use explicit memory ordering. Won't make much difference on x86/x64 but may be faster on other architectures. 4. Add a stress-test to try to make sure we haven't messed up.
Some internal warnings regarding utility code were moved:
|
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.
Given the speed improvement that you report, I consider this a candidate for 3.0rc1. What do you think?
Co-authored-by: scoder <stefan_ml@behnel.de>
…moryview-ref-counting
The speed improvement is ~20% on a very artificial test-case (I think it's the kind of code that people tend not to write in reality, because it's a bit slow). So it's decent, but won't really change anyone's calculations about what to write. #5508 will give a much more dramatic speed increase for the same case (and complements this rather than replaces it). I think this PR is fairly low risk (to the extent that anyone really understands atomics), while the other PR needs a more careful look and a bit of polishing. So I'm personally inclined to merge this one. If we do see issues with this, it'll be on non-x86 platforms, which I don't think we currently test. |
Closes #5509