STLは省エネ
前自分の作った queue クラスと、STLコンテナの queue を比較してみたらとんでもない違いがでて、STLすげえなあ、と思いつつ。あ、時間もメモリも1/3くらいだった。
1000万のデータのpush->pop。
% time ./queue_test_1000 after initialize: queue data : 0 -> end. start test: 10000000 => 20000000 => 30000000 => 40000000 => 50000000 => 60000000 => 70000000 => 80000000 => 90000000 => 100000000 => 90000000 => 80000000 => 70000000 => 60000000 => 50000000 => 40000000 => 30000000 => 20000000 => 10000000 => end of test. queue data : 99999999 -> end. ./queue_test_1000 16.20s user 1.45s system 97% cpu 18.173 total % time ./stl_queue_test_1000 after initialize: start test: 10000000 => 20000000 => 30000000 => 40000000 => 50000000 => 60000000 => 70000000 => 80000000 => 90000000 => 100000000 => 90000000 => 80000000 => 70000000 => 60000000 => 50000000 => 40000000 => 30000000 => 20000000 => 10000000 => end of test. ./stl_queue_test_1000 5.48s user 0.36s system 97% cpu 6.000 total