summaryrefslogtreecommitdiff
path: root/lib/gras_impl
diff options
context:
space:
mode:
authorJosh Blum2012-12-06 20:01:45 -0800
committerJosh Blum2012-12-06 20:01:45 -0800
commit66923334739341a00c2d7fa2a90504ca2f2835fc (patch)
tree4688c31454d0dcd653fc9659e0a39963d9b89d0b /lib/gras_impl
parentb5ce30933dd10754a43876ef50a0eed7040c6f97 (diff)
downloadsandhi-66923334739341a00c2d7fa2a90504ca2f2835fc.tar.gz
sandhi-66923334739341a00c2d7fa2a90504ca2f2835fc.tar.bz2
sandhi-66923334739341a00c2d7fa2a90504ca2f2835fc.zip
guess at heuristic improvement - somewhat profiles
Diffstat (limited to 'lib/gras_impl')
-rw-r--r--lib/gras_impl/input_buffer_queues.hpp9
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]);