Skip to content
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

Problems with comments in F14Table #1144

Closed
leventov opened this issue May 31, 2019 · 1 comment
Closed

Problems with comments in F14Table #1144

leventov opened this issue May 31, 2019 · 1 comment

Comments

@leventov
Copy link
Contributor

First is from here: #1142 (comment)

// Returns true iff a rehash was performed
void reserveForInsert(size_t incoming = 1) {
doesn't seem that this function returns anything now

Second:

FOLLY_NOINLINE void reserveForInsertImpl(
std::size_t capacityMinusOne,
std::size_t origChunkCount,
std::size_t origCapacityScale,
std::size_t origCapacity) {
FOLLY_SAFE_DCHECK(capacityMinusOne >= size(), "");
std::size_t capacity = capacityMinusOne + 1;
// we want to grow by between 2^0.5 and 2^1.5 ending at a "good"
// size, so we grow by 2^0.5 and then round up
// 1.01101_2 = 1.40625
std::size_t minGrowth = origCapacity + (origCapacity >> 2) +
(origCapacity >> 3) + (origCapacity >> 5);
capacity = std::max<std::size_t>(capacity, minGrowth);

I cannot make sense of the comment (why would growing by 2^1.5 ~= 2.8 be optimal, when the chunk array's size is always a power of two?), it might be a typo where 2^1.0 was actually intended, but not sure.

@yfeldblum
Copy link
Contributor

@nbronson for the growth strategy.

@yfeldblum yfeldblum closed this as not planned Won't fix, can't repro, duplicate, stale Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants