Commit da4f8179 authored by Xavier Thompson's avatar Xavier Thompson

Revert "ring_buffer: Reduce resizing frequency"

This reverts commit f9c96ad3.
parent 6405c78f
...@@ -84,7 +84,7 @@ namespace typon::fdt::lock_free ...@@ -84,7 +84,7 @@ namespace typon::fdt::lock_free
_bottom.store(bottom + 1, relaxed); _bottom.store(bottom + 1, relaxed);
} }
u64 capacity = array->capacity(); u64 capacity = array->capacity();
if (capacity > u64(1) << _bits && capacity > (bottom - top) * 8) if (capacity > u64(1) << _bits && capacity > (bottom - top) * 4)
{ {
x.set_state(Prune); x.set_state(Prune);
} }
......
...@@ -63,7 +63,7 @@ namespace typon::fdt::lock_free ...@@ -63,7 +63,7 @@ namespace typon::fdt::lock_free
ring_buffer * grow(u64 start, u64 end) noexcept ring_buffer * grow(u64 start, u64 end) noexcept
{ {
auto buffer = new ring_buffer(std::countr_one(_mask) + 2, this); auto buffer = new ring_buffer(std::countr_one(_mask) + 1, this);
return fill(buffer, start, end); return fill(buffer, start, end);
} }
...@@ -72,7 +72,7 @@ namespace typon::fdt::lock_free ...@@ -72,7 +72,7 @@ namespace typon::fdt::lock_free
ring_buffer * last = nullptr; ring_buffer * last = nullptr;
auto next = this; auto next = this;
auto size = (end - start); auto size = (end - start);
auto threshold = size * 4; auto threshold = size * 2;
while (next->_next && next->_next->capacity() >= threshold) while (next->_next && next->_next->capacity() >= threshold)
{ {
last = next; 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