Skip to content

Commit

Permalink
Benchmark program is wrong; it sorts sorted vectors (thanks to ak)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuji Goro committed Oct 19, 2011
1 parent cb1412c commit 392af11
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
20 changes: 9 additions & 11 deletions README.md
Expand Up @@ -11,18 +11,16 @@ An example output is (scale: sec.):

int
size 100000
std::sort 0.12273
std::stable_sort 0.182555
timsort 0.021382
std::sort 0.631852
std::stable_sort 0.846656
timsort 1.1865
double
size 100000
std::sort 0.121308
std::stable_sort 0.221106
timsort 0.026283
std::sort 0.759048
std::stable_sort 1.04307
timsort 1.30662
boost::rational
size 100000
std::sort 3.60624
std::stable_sort 2.60706
timsort 0.319079

Looks great.
std::sort 5.94573
std::stable_sort 5.41838
timsort 5.33095
6 changes: 3 additions & 3 deletions bench.cpp
Expand Up @@ -24,10 +24,10 @@ void bench(int const size) {
std::random_shuffle(a.begin(), a.end());

{
std::vector<value_t> b(a);
boost::timer t;

for(int i = 0; i < 100; ++i) {
std::vector<value_t> b(a);
std::sort(b.begin(), b.end(), lt);
}

Expand All @@ -36,10 +36,10 @@ void bench(int const size) {


{
std::vector<value_t> b(a);
boost::timer t;

for(int i = 0; i < 100; ++i) {
std::vector<value_t> b(a);
std::stable_sort(b.begin(), b.end(), lt);
}

Expand All @@ -48,10 +48,10 @@ void bench(int const size) {


{
std::vector<value_t> b(a);
boost::timer t;

for(int i = 0; i < 100; ++i) {
std::vector<value_t> b(a);
timsort(b.begin(), b.end(), lt);
}

Expand Down

0 comments on commit 392af11

Please sign in to comment.