Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 3rd, 2012  |  syntax: None  |  size: 0.55 KB  |  views: 29  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. template< class StackType >
  2. void test( char const* const description )
  3. {
  4.     for( int it = 0; it < 4; ++it )
  5.     {
  6.         StackType st;
  7.  
  8.         HighResolutionTimer timer;
  9.  
  10.         timer.Start();
  11.  
  12.         for( Index i = 0; i < 1000000000; ++i )
  13.         {
  14.             st.push( i );
  15.             if( i % 1000 == 0 && i != 0 )
  16.             {
  17.                 for( int j = 0; j < 1000; ++j ) { st.pop(); }
  18.             }
  19.         }
  20.  
  21.         double const totalTime = timer.Stop();
  22.         wcout << description << ": "  << totalTime << endl;
  23.     }
  24. }
clone this paste RAW Paste Data