From 66923334739341a00c2d7fa2a90504ca2f2835fc Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Thu, 6 Dec 2012 20:01:45 -0800 Subject: guess at heuristic improvement - somewhat profiles --- lib/gras_impl/input_buffer_queues.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/gras_impl') 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]); -- cgit