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
[DO NOT MERGE][stdlib] Keep Dictionary storage at least 25% full when possible #26921
base: main
Are you sure you want to change the base?
Conversation
Just to see if we have adequate benchmarks for Dictionary removals: @swift-ci benchmark |
@swift-ci test |
Performance: -O
Code size: -O
Performance: -Osize
Code size: -Osize
Performance: -Onone
Code size: -swiftlibsHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
A 2x slowdown matches how insertion behaves when capacity was reserved vs when it wasn't. Some of it is probably spent on runtime availability checks that we could perhaps eliminate. |
Build failed |
This is an experimental implementation of shrinking Dictionary storage after removals.
It isn't clear this is worth doing, and the bulk of the actual work towards landing it would be in benchmarking and adding test coverage, which is not at all done. However, the implementation is an interesting exercise in library evolution.
It's almost possible to make this feature deploy back to earlier OSes -- except Set/Dictionary doesn't record the reserved capacity in 5.0 & 5.1, and that arguably rules out shrinking. (We'd also have to make the minimum load factor part of the ABI, but that's less of an issue.)
rdar://problem/18114559