summaryrefslogtreecommitdiff
path: root/lib/gras_impl/input_buffer_queues.hpp
diff options
context:
space:
mode:
authorJosh Blum2012-11-28 21:38:26 -0800
committerJosh Blum2012-11-28 21:38:26 -0800
commit705ed5f0d80b8b2bcaf2dc84696b35399cf9ed77 (patch)
tree816c5206da7d7d7a26d88d318b067a391a580639 /lib/gras_impl/input_buffer_queues.hpp
parentfdce6faa0c4b7a1dc1fa42b2ce15dd8aa2c0c8b7 (diff)
downloadsandhi-705ed5f0d80b8b2bcaf2dc84696b35399cf9ed77.tar.gz
sandhi-705ed5f0d80b8b2bcaf2dc84696b35399cf9ed77.tar.bz2
sandhi-705ed5f0d80b8b2bcaf2dc84696b35399cf9ed77.zip
should we accumulate? a guess at heuristic improvement
Diffstat (limited to 'lib/gras_impl/input_buffer_queues.hpp')
-rw-r--r--lib/gras_impl/input_buffer_queues.hpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/gras_impl/input_buffer_queues.hpp b/lib/gras_impl/input_buffer_queues.hpp
index 80f350b..f81f226 100644
--- a/lib/gras_impl/input_buffer_queues.hpp
+++ b/lib/gras_impl/input_buffer_queues.hpp
@@ -53,10 +53,13 @@ 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 should_accumulate = _queues[i].front().length <= 128;
+
+ if (must_accumulate or should_accumulate) this->accumulate(i);
+
ASSERT(_queues[i].front().length >= _reserve_bytes[i]);
ASSERT((_queues[i].front().length % _items_sizes[i]) == 0);
@@ -231,6 +234,8 @@ inline void InputBufferQueues::update_config(
GRAS_FORCE_INLINE void InputBufferQueues::accumulate(const size_t i)
{
+ if (this->is_accumulated(i)) return;
+
if (_aux_queues[i]->empty())
{
_aux_queues[i]->allocate_one(_maximum_bytes[i]);