leerho commented on PR #569: URL: https://github.com/apache/datasketches-cpp/pull/569#issuecomment-6903573772
Thanks, good catch (I read your second point as "after the first update"). That was the documented behavior, but you're right that the two should match: `reserve()` should mean that the buffer does not need to grow before the first compaction, whenever it is called. t-digest's `reserve()` already works that way, and REQ's first allocation is already full size, so it has no partly grown buffer. So now, if the buffer is still growing, `reserve()` grows it to k items in one step, keeping the items already in it. Once the buffer has k items, or after the first compaction, it does nothing. `grow_items()` now takes the new size, so `reserve()` and the growth on update share it. The test "reserve() after updates grows the buffer to k items" replaces "reserve() after the first update does nothing": after 10 updates, `reserve()` grows the buffer to k, and updates up to k items allocate nothing more. All tests pass under ASan and UBSan. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
