-
Notifications
You must be signed in to change notification settings - Fork 13k
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
benchmark whether 1.5x is a better growth factor for vectors #4961
Comments
I run a simple benchmark with changed container growth rate: 2x to 1.5x Experiment setting:
Result - average running time:
Here's raw data: https://docs.google.com/spreadsheet/ccc?key=0AjFZD5XgU6lFdEhHM0hWTi1NQU9VcHdRVThmOGFub0E#gid=0 Compile time decreases by 2.5 seconds, which is quite marginal in my opinion. Maybe we should test it with some well-known container benchmarks. |
Removing from 1.0 |
There are a lot bigger fish to fry, but this is still relevant |
Just adding to the pile, facebook has done some research on this also: https://github.com/facebook/folly/blob/master/folly/docs/FBVector.md |
We should likely use the |
libc++ uses a 2x multiplier for vector growth too. I think integration with various allocators is a better option than trying to find a good magic number here. |
Using a number lower than the golden ratio is supposed to play better with allocator pools and reduce memory fragmentation.
https://crntaylor.wordpress.com/2011/07/15/optimal-memory-reallocation-and-the-golden-ratio/
The text was updated successfully, but these errors were encountered: