Commit f9c96ad3 authored by Xavier Thompson's avatar Xavier Thompson

ring_buffer: Reduce resizing frequency

parent 880da8d0
......@@ -84,7 +84,7 @@ namespace typon::fdt::lock_free
_bottom.store(bottom + 1, relaxed);
}
u64 capacity = array->capacity();
if (capacity > u64(1) << _bits && capacity > (bottom - top) * 4)
if (capacity > u64(1) << _bits && capacity > (bottom - top) * 8)
{
x.set_state(Prune);
}
......
......@@ -63,7 +63,7 @@ namespace typon::fdt::lock_free
ring_buffer * grow(u64 start, u64 end) noexcept
{
auto buffer = new ring_buffer(std::countr_one(_mask) + 1, this);
auto buffer = new ring_buffer(std::countr_one(_mask) + 2, this);
return fill(buffer, start, end);
}
......@@ -72,7 +72,7 @@ namespace typon::fdt::lock_free
ring_buffer * last = nullptr;
auto next = this;
auto size = (end - start);
auto threshold = size * 2;
auto threshold = size * 4;
while (next->_next && next->_next->capacity() >= threshold)
{
last = next;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment