diff options
Diffstat (limited to 'lib/gras_impl')
-rw-r--r-- | lib/gras_impl/input_buffer_queues.hpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/gras_impl/input_buffer_queues.hpp b/lib/gras_impl/input_buffer_queues.hpp index af0cf37..83ed44b 100644 --- a/lib/gras_impl/input_buffer_queues.hpp +++ b/lib/gras_impl/input_buffer_queues.hpp @@ -53,7 +53,14 @@ struct InputBufferQueues if (_queues[i].empty()) return get_null_buff(); //there are enough enqueued bytes, but not in the front buffer - if (_queues[i].front().length < _reserve_bytes[i]) this->accumulate(i); + const bool must_accumulate = _queues[i].front().length < _reserve_bytes[i]; + + //should we accumulate? a guess at heuristic improvement + const bool heavy_load = _enqueued_bytes[i] >= _maximum_bytes[i]; + const bool light_front = _queues[i].front().length <= _maximum_bytes[i]/2; + const bool should_accumulate = heavy_load and light_front; + + if (must_accumulate or should_accumulate) this->accumulate(i); ASSERT(_queues[i].front().length >= _reserve_bytes[i]); |