예제 #1
0
void test<CONTAINER,HANDLER>::insert(unsigned count, bool warm, bool write)
{
  CONTAINER container;
  if (warm) {
    container.push_back(0); container.push_back(0);
    typename CONTAINER::iterator iter = ++container.begin();
    for(unsigned ii = 0; ii != count; ++ii) {
      iter = _handler.insert(container, iter, 1);
      if (ii & 1) ++iter;
    }
    container.clear();
  }
  container.push_back(0); container.push_back(0);
  boost::timer::cpu_timer timer;
  timer.start();
  typename CONTAINER::iterator iter = ++container.begin();
  for(unsigned ii = 0; ii != count; ++ii) {
    iter = _handler.insert(container, iter, 1);
    if (ii & 1) ++iter;
  }
  timer.stop();
  if (write) {
    dump(timer, "middle insert", count, warm);
  }
}
예제 #2
0
void
clear_map_pointers( CONTAINER& container )
{
    typename CONTAINER::iterator i = container.begin();
    while ( i != container.end() )
    {
        delete i->second;
        ++i;
    }

    container.clear();
}
예제 #3
0
void test<CONTAINER,HANDLER>::push_front(unsigned count, bool warm, bool write)
{
  CONTAINER container;
  if (warm) {
    for(unsigned ii = 0; ii != count; ++ii)
      _handler.push_front(container, 1);
    container.clear();
  }

  boost::timer::cpu_timer timer;
  timer.start();
  for(unsigned ii = 0; ii != count; ++ii)
    _handler.push_front(container, 1);
  timer.stop();
  if (write) {
    dump(timer, "push_front", count, warm);
  }
}