carbon-language / carbon-lang

Carbon Language's main repository: documents, design, implementation, and related tools. (NOTE: Carbon Language is experimental; see README)
https://github.com/carbon-language/carbon-lang/blob/trunk/README.md
Other
32.31k stars 1.48k forks source link

Add growth API to the new hashtables. #4044

Closed chandlerc closed 2 weeks ago

chandlerc commented 3 weeks ago

This adds two different growth APIs. This is instead of the more conventional STL reserve method. One allows users that aren't trying to grow in anticipation of an exact count of insertions, but generally trying to size the table to the correct ballpark with a power-of-two estimate.

The other API allows pre-growing to allow a specific number of insertions to be performed without further growth. This API takes the maximum load factor and other implementation details into account.