Boost logo

Boost-Commit :

From: hartmut.kaiser_at_[hidden]
Date: 2008-04-13 21:47:46


Author: hkaiser
Date: 2008-04-13 21:47:46 EDT (Sun, 13 Apr 2008)
New Revision: 44390
URL: http://svn.boost.org/trac/boost/changeset/44390

Log:
Applied a minor optimization to one of the multi_pass policies.
Text files modified:
   trunk/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp | 10 +++++-----
   1 files changed, 5 insertions(+), 5 deletions(-)

Modified: trunk/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp
==============================================================================
--- trunk/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp (original)
+++ trunk/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp 2008-04-13 21:47:46 EDT (Sun, 13 Apr 2008)
@@ -25,7 +25,7 @@
     ///////////////////////////////////////////////////////////////////////////
     struct split_std_deque
     {
- enum { threshold = 1000 };
+ enum { threshold = 16 };
         
         ///////////////////////////////////////////////////////////////////////
         template <typename Value>
@@ -89,13 +89,13 @@
                         // free up the memory used by the queue. we avoid
                         // clearing the queue on every increment, though,
                         // because this would be too time consuming
- queue.clear();
- queue.reserve(threshold);
+
+ // erase all but first item in queue
+ queue.erase(queue.begin()+1, queue.end());
                         mp.queued_position = 0;
                         
- // create a new entry in the queue and initialize
+ // reuse first entry in the queue and initialize
                         // it from the input
- queue.push_back(Value());
                         MultiPass::advance_input(mp, queue[mp.queued_position++]);
                     }
                     else


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk