2015-01-29

IntroSort vs CombSort vs ShellSort vs HeapSort vs MergeSort

As we already know, that GCC's std::sort uses IntroSort (a QuickSort algorithm that changes into HeapSort when recursion depth is too deep). Also as we already know that CombSort is improved version of BubbleSort, and ShellSort is improved version of InsertionSort), but sometimes we don't know, how good are they in real-life benchmark. So today I tried to compare them all (with addition HeapSort and inplace MergeSort). My setup is 64-bit Linux 3.18.2-1, Intel i3-4150, 8 GB RAM, Non-SSD disk, here's the code:

// intro.cpp
#include<cstdlib>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N = 10000000;
int main() {
    int* arr = new int[N];
    for(int z=0;z<N;++z) arr[z] = rand();
    sort(arr,arr+N);
    for(int z=1;z<N;++z) if(arr[z]<arr[z-1]) printf("!");
    delete[] arr;
}

// comb.cpp
#include<cstdlib>
#include<cstdio>
#include<algorithm>
using namespace std;
int newGap(int gap){
    gap /= 1.3;
    if(gap == 9 || gap == 10) gap = 11;
    if(gap < 1) return 1;
    return gap;
}
void combSort(int a[], int len){
    int gap = len;
    bool swapped;
    do {
        swapped = false;
        gap = newGap(gap);
        for(int i=0; i < len-gap; ++i) {
            if(a[i] > a[i+gap]) {
                swapped = true;
                swap(a[i], a[i+gap]);
            }
        }
    } while(gap > 1 || swapped);
}
const int N = 10000000;
int main() {
    int* arr = new int[N];
    for(int z=0;z<N;++z) arr[z] = rand();    
    combSort(arr,N);
    for(int z=1;z<N;++z) if(arr[z]<arr[z-1]) printf("!");
    delete[] arr;
}

// shell.cpp
#include<cstdlib>
#include<cstdio>
#include<deque>
#include<algorithm>
using namespace std;
void shellSortPhase(int a[], int length, int gap) {
    int i;
    for (i = gap; i < length; ++i) {
        int value = a[i];
        int j;
        for (j = i - gap; j >= 0 && a[j] > value; j -= gap) a[j + gap] = a[j];
        a[j + gap] = value;
    }
}
void shellSort(int a[], size_t length) { 
    deque<int> gaps;
    for(size_t z=length/2;z>701;z/=2) gaps.push_front(z);
    static int cuira[] = {701,301,132,57,23,10,4,1};
    for(int z=0;z<sizeof(cuira)/sizeof(int);++z) gaps.push_front(cuira[z]);
    while(gaps.size()) {
        shellSortPhase(a, length, gaps.back());
        gaps.pop_back();
    }
}
const int N = 10000000;
int main() {
    int* arr = new int[N];
    for(int z=0;z<N;++z) arr[z] = rand();    
    shellSort(arr,N);
    for(int z=1;z<N;++z) if(arr[z]<arr[z-1]) printf("!");    
    delete[] arr;
}

// heap.cpp
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<iostream>
using namespace std;
const int N = 10000000;
int main() {
    int* arr = new int[N];
    for(int z=0;z<N;++z) arr[z] = rand();
    make_heap(arr,arr+N);
    sort_heap(arr,arr+N);
    for(int z=1;z<N;++z) if(arr[z]<arr[z-1]) printf("!");
    delete[] arr;
}

// merge.cpp
#include<vector>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
void merge_sort( int* beg, int* end) {
    if (end - beg > 1)  {
        int* mid = beg + (end - beg) / 2;
        merge_sort(beg, mid);
        merge_sort(mid, end);
        inplace_merge(beg, mid, end);
    }
}
const int N = 10000000;
int main() {
    int* arr = new int[N];
    for(int z=0;z<N;++z) arr[z] = rand();
    merge_sort(arr,arr+N);
    for(int z=1;z<N;++z) if(arr[z]<arr[z-1]) printf("!");
    delete[] arr;
}

The benchmark result for 10M items:

$ g++ intro.cpp ; time ./a.out 

real    0m2.515s
user    0m2.503s
sys     0m0.007s

$ g++ comb.cpp ; time ./a.out 

real    0m3.457s
user    0m3.443s
sys     0m0.007s

$ g++ shell.cpp ; time ./a.out 

real    0m4.109s
user    0m4.103s
sys     0m0.003s

$ g++ heap.cpp ; time ./a.out 

real    0m4.478s
user    0m4.470s
sys     0m0.003s

$ g++ merge.cpp ; time ./a.out 

real    0m3.748s
user    0m3.743s
sys     0m0.007s

Result with -O2 flag:

$ g++ -O2 intro.cpp ; time ./a.out 

real    0m0.806s
user    0m0.797s
sys     0m0.007s

$ g++ -O2 comb.cpp ; time ./a.out 

real    0m1.421s
user    0m1.417s
sys     0m0.000s

$ g++ -O2 shell.cpp ; time ./a.out 

real    0m1.959s
user    0m1.950s
sys     0m0.003s

$ g++ -O2 heap.cpp ; time ./a.out 

real    0m2.373s
user    0m2.357s
sys     0m0.010s

$ g++ -O2 merge.cpp ; time ./a.out

real    0m1.384s
user    0m1.360s
sys     0m0.017s

As we could see both are quite good enough, at par with some O(n log n) sorting algorithms.

Just for comparison let's compare with O(n^2) sorting algorithms, with lower number of items:

// sel.cpp
#include<cstdlib>
#include<cstdio>
#include<algorithm>
using namespace std;
void selSort(int a[], size_t length) {
    for(size_t z=0;z<length-1;++z) {
        size_t best = z;
        for(size_t y=z+1;y<length;++y) if(a[best]>a[y]) best = y;
        if(z!=best) swap(a[best],a[z]);
    }    
}
const int N = 200000;
int main() {
    int* arr = new int[N];
    for(int z=0;z<N;++z) arr[z] = rand();
    selSort(arr,N);
    for(int z=1;z<N;++z) if(arr[z]<arr[z-1]) printf("!");
    delete[] arr;
}

// bub.cpp
#include<cstdlib>
#include<cstdio>
#include<algorithm>
using namespace std;
void bubSort(int a[], size_t length) {
    for(size_t z=length-1;z>0;--z) {
        for(size_t y=0;y<z;++y) if(a[y]>a[y+1]) swap(a[y],a[y+1]);
    }    
}
const int N = 200000;
int main() {
    int* arr = new int[N];
    for(int z=0;z<N;++z) arr[z] = rand();
    bubSort(arr,N);
    for(int z=1;z<N;++z) if(arr[z]<arr[z-1]) printf("!");
    delete[] arr;
}

// ins.cpp
#include<cstdlib>
#include<cstdio>
#include<algorithm>
using namespace std;
void insSort(int a[], size_t length) {
    for(size_t z=1;z<length;++z) {
    int copy = a[z];    
    size_t y = z;
        for(;y>0 && a[y-1]>copy;--y) a[y] = a[y-1];
        a[y] = copy;
    }    
}
const int N = 200000;
int main() {
    int* arr = new int[N];
    for(int z=0;z<N;++z) arr[z] = rand();
    insSort(arr,N);
    for(int z=1;z<N;++z) if(arr[z]<arr[z-1]) printf("!");
    delete[] arr;
}

// bin-ins.cpp
#include<cstdlib>
#include<cstdio>
#include<algorithm>
using namespace std;
void binInsSort(int data[], int size) {
    int index = -1,i = 1,j;
    for(;i<size;i++) {
        int temp = data[i];
        int high = i,low = 0,mid;
        while(low <= high) {
            mid = (low + high) /2;
            if(temp < data[mid]) {
                high = mid - 1;
                index = mid;
            } else if (temp > data[mid]) {
                low = mid + 1;      
            } else if(data[mid] == temp) {
                index = mid;
                break; 
            } 
        }
        for(j = i;j > index;j--) data[j] = data[j-1];
        data[j] = temp;
    }   
}
const int N = 200000;
int main() {
    int* arr = new int[N];
    for(int z=0;z<N;++z) arr[z] = rand();
    binInsSort(arr,N);
    for(int z=1;z<N;++z) if(arr[z]<arr[z-1]) printf("!");
    delete[] arr;
}

The benchmark result for 200K items:

$ g++ -O2 bub.cpp ; time ./a.out 

real    0m54.837s
user    0m54.790s
sys     0m00.000s

$ g++ -O2 sel.cpp ; time ./a.out 

real    0m51.671s
user    0m51.623s
sys     0m00.000s

$ g++ -O2 ins.cpp ; time ./a.out

real    0m4.513s
user    0m4.507s
sys     0m0.000s

$ g++ -O2 bin-ins.cpp ; time ./a.out 

real    0m3.736s
user    0m3.730s
sys     0m0.000s

The benchmark for 500K items:

$ g++ -O2 ins.cpp ; time ./a.out 

real    0m31.179s
user    0m31.137s
sys     0m00.003s

$ g++ -O2 bin-ins.cpp ; time ./a.out 

real    0m24.109s
user    0m24.087s
sys     0m00.000s


Apparently I was wrong, till recently I thought that SelectionSort is faster than InsertionSort (because of lower number of write/swap), but now I know that it doesn't..


2015-01-27

Vivaldi: New Chromium-based Web Browser

So today a new web browser, another chromium-based released, the name is Vivaldi. The review? first thing: Ctrl+Enter doesn't work, in another browser its usually for appending ".com" and go! Ctrl+L (location bar), Ctrl+H (history), Ctrl+J (download) works fine. Opening many tabs lags a lot, maybe because of their skin. You can install it on Windows, Mac, UbuntuFedora, also on ArchLinux using this command:
yaourt -Sy vivaldi



So, how about their javascript performance? Here's the result of SunSpider benchmark

Vivaldi 1.0.83.38 (Developer Build) stable
============================================
RESULTS (means and 95% confidence intervals)
--------------------------------------------
Total:                 228.3ms +/- 1.3%
--------------------------------------------

  3d:                   43.1ms +/- 3.1%
    cube:               13.0ms +/- 4.5%
    morph:              17.5ms +/- 2.9%
    raytrace:           12.6ms +/- 4.0%

  access:               17.6ms +/- 2.8%
    binary-trees:        2.0ms +/- 0.0%
    fannkuch:            7.9ms +/- 5.1%
    nbody:               4.0ms +/- 0.0%
    nsieve:              3.7ms +/- 9.3%

  bitops:               13.2ms +/- 3.4%
    3bit-bits-in-byte:   1.2ms +/- 25.1%
    bits-in-byte:        3.0ms +/- 0.0%
    bitwise-and:         4.1ms +/- 5.5%
    nsieve-bits:         4.9ms +/- 4.6%

  controlflow:           2.3ms +/- 15.0%
    recursive:           2.3ms +/- 15.0%

  crypto:               16.7ms +/- 4.1%
    aes:                 6.5ms +/- 5.8%
    md5:                 5.2ms +/- 8.7%
    sha1:                5.0ms +/- 0.0%

  date:                 23.3ms +/- 3.2%
    format-tofte:       12.1ms +/- 1.9%
    format-xparb:       11.2ms +/- 6.6%

  math:                 23.2ms +/- 3.8%
    cordic:              4.9ms +/- 4.6%
    partial-sums:       14.9ms +/- 1.5%
    spectral-norm:       3.4ms +/- 20.3%

  regexp:                8.1ms +/- 2.8%
    dna:                 8.1ms +/- 2.8%

  string:               80.8ms +/- 1.8%
    base64:              8.4ms +/- 4.4%
    fasta:              12.2ms +/- 2.5%
    tagcloud:           26.8ms +/- 2.8%
    unpack-code:        23.2ms +/- 3.2%
    validate-input:     10.2ms +/- 3.0%
Firefox 35.0
============================================
RESULTS (means and 95% confidence intervals)
--------------------------------------------
Total:                 195.3ms +/- 1.3%
--------------------------------------------

  3d:                   32.0ms +/- 3.2%
    cube:               12.1ms +/- 5.9%
    morph:               6.6ms +/- 5.6%
    raytrace:           13.3ms +/- 3.6%

  access:               19.0ms +/- 6.4%
    binary-trees:        3.9ms +/- 10.4%
    fannkuch:            7.8ms +/- 8.4%
    nbody:               3.6ms +/- 10.3%
    nsieve:              3.7ms +/- 13.0%

  bitops:               11.4ms +/- 3.2%
    3bit-bits-in-byte:   1.1ms +/- 20.5%
    bits-in-byte:        2.7ms +/- 12.8%
    bitwise-and:         2.5ms +/- 15.1%
    nsieve-bits:         5.1ms +/- 4.4%

  controlflow:           2.8ms +/- 10.8%
    recursive:           2.8ms +/- 10.8%

  crypto:               19.2ms +/- 3.4%
    aes:                 9.6ms +/- 5.2%
    md5:                 4.9ms +/- 4.6%
    sha1:                4.7ms +/- 7.3%

  date:                 22.2ms +/- 3.0%
    format-tofte:        9.8ms +/- 3.1%
    format-xparb:       12.4ms +/- 4.0%

  math:                 15.5ms +/- 2.4%
    cordic:              3.1ms +/- 7.3%
    partial-sums:       10.2ms +/- 3.0%
    spectral-norm:       2.2ms +/- 13.7%

  regexp:                9.0ms +/- 3.7%
    dna:                 9.0ms +/- 3.7%

  string:               64.2ms +/- 2.6%
    base64:              8.0ms +/- 9.4%
    fasta:               8.6ms +/- 4.3%
    tagcloud:           17.2ms +/- 3.3%
    unpack-code:        21.5ms +/- 3.6%
    validate-input:      8.9ms +/- 8.0%
Opera 26.0.1656.60
============================================
RESULTS (means and 95% confidence intervals)
--------------------------------------------
Total:                 235.4ms +/- 1.6%
--------------------------------------------

  3d:                   46.4ms +/- 7.3%
    cube:               13.7ms +/- 4.3%
    morph:              19.7ms +/- 12.7%
    raytrace:           13.0ms +/- 6.9%

  access:               17.9ms +/- 6.1%
    binary-trees:        1.8ms +/- 16.7%
    fannkuch:            8.2ms +/- 5.5%
    nbody:               4.0ms +/- 11.9%
    nsieve:              3.9ms +/- 10.4%

  bitops:               12.7ms +/- 4.6%
    3bit-bits-in-byte:   1.3ms +/- 26.6%
    bits-in-byte:        3.0ms +/- 0.0%
    bitwise-and:         4.1ms +/- 5.5%
    nsieve-bits:         4.3ms +/- 8.0%

  controlflow:           2.1ms +/- 10.8%
    recursive:           2.1ms +/- 10.8%

  crypto:               17.7ms +/- 6.6%
    aes:                 6.9ms +/- 7.6%
    md5:                 5.4ms +/- 14.2%
    sha1:                5.4ms +/- 6.8%

  date:                 24.7ms +/- 3.6%
    format-tofte:       12.7ms +/- 2.7%
    format-xparb:       12.0ms +/- 7.4%

  math:                 22.8ms +/- 2.9%
    cordic:              5.0ms +/- 9.5%
    partial-sums:       15.0ms +/- 3.9%
    spectral-norm:       2.8ms +/- 10.8%

  regexp:                8.0ms +/- 4.2%
    dna:                 8.0ms +/- 4.2%

  string:               83.1ms +/- 1.4%
    base64:              8.8ms +/- 10.0%
    fasta:              12.7ms +/- 3.8%
    tagcloud:           28.5ms +/- 3.4%
    unpack-code:        23.1ms +/- 3.1%
    validate-input:     10.0ms +/- 0.0%
Chromium 39.0.2171.99 (64-bit)
============================================
RESULTS (means and 95% confidence intervals)
--------------------------------------------
Total:                 242.2ms +/- 2.2%
--------------------------------------------

  3d:                   46.6ms +/- 8.8%
    cube:               13.5ms +/- 5.1%
    morph:              20.7ms +/- 16.3%
    raytrace:           12.4ms +/- 5.6%

  access:               18.5ms +/- 4.2%
    binary-trees:        2.2ms +/- 13.7%
    fannkuch:            8.1ms +/- 6.5%
    nbody:               4.2ms +/- 7.2%
    nsieve:              4.0ms +/- 8.4%

  bitops:               13.0ms +/- 3.7%
    3bit-bits-in-byte:   1.5ms +/- 25.1%
    bits-in-byte:        2.9ms +/- 7.8%
    bitwise-and:         3.9ms +/- 5.8%
    nsieve-bits:         4.7ms +/- 7.3%

  controlflow:           2.0ms +/- 0.0%
    recursive:           2.0ms +/- 0.0%

  crypto:               17.8ms +/- 5.9%
    aes:                 6.8ms +/- 8.3%
    md5:                 5.4ms +/- 9.3%
    sha1:                5.6ms +/- 17.2%

  date:                 22.4ms +/- 2.2%
    format-tofte:       11.8ms +/- 5.6%
    format-xparb:       10.6ms +/- 4.7%

  math:                 23.6ms +/- 2.6%
    cordic:              4.9ms +/- 4.6%
    partial-sums:       15.4ms +/- 3.2%
    spectral-norm:       3.3ms +/- 14.6%

  regexp:                8.0ms +/- 0.0%
    dna:                 8.0ms +/- 0.0%

  string:               90.3ms +/- 4.8%
    base64:              8.5ms +/- 12.1%
    fasta:              11.2ms +/- 5.0%
    tagcloud:           34.8ms +/- 4.9%
    unpack-code:        26.0ms +/- 18.5%
    validate-input:      9.8ms +/- 5.8%

Javascript speed in latest browser doesn't really matter now, they are already blazing fast.

2015-01-26

PHP/HHVM vs Go vs NodeJs BubbleSort Benchmark

So, I wonder about how good HHVM now, the code was taken from this post. My setup is 64-bit Linux 3.18.2-1, AMD A8-6600K, 16 GB RAM, Non-SSD disk, here's the best result of each implementation:

PHP 5.6.4

$ time php bench.php 
Array
(
    [0] => 1
    [1] => 1
    [2] => 2
    [3] => 3
    [4] => 3
    [5] => 4
    [6] => 5
    [7] => 12
    [8] => 52
    [9] => 92
    [10] => 424
    [11] => 4124
)
2.3711581230164
real    0m2.383s
user    0m2.373s
sys     0m0.010s

HHVM 3.5.0

$ time hhvm -v Eval.Jit=true bench.php 
Array
(
    [0] => 1
    [1] => 1
    [2] => 2
    [3] => 3
    [4] => 3
    [5] => 4
    [6] => 5
    [7] => 12
    [8] => 52
    [9] => 92
    [10] => 424
    [11] => 4124
)
0.13958597183228
real    0m0.414s
user    0m0.247s
sys     0m0.033s

Go 1.4.1
And yes, I include the compile time also for fairness.

$ rm bench; time(go build bench.go && ./bench)
removed ‘bench’
[1 1 2 3 3 4 5 12 52 92 424 4124]
23.027575ms
real    0m0.191s
user    0m0.150s
sys     0m0.033s

$ time ./bench 
[1 1 2 3 3 4 5 12 52 92 424 4124]
22.757741ms
real    0m0.024s
user    0m0.023s
sys     0m0.000s

NodeJS 0.10.35

$ time node bench.js
[ 1, 1, 2, 3, 3, 4, 5, 12, 52, 92, 424, 4124 ]
42

real    0m0.065s
user    0m0.060s
sys     0m0.003s

From what we could see (run duration - actual duration):
Go: 22ms - 24ms
NodeJS: 42ms - 65ms
Go (with compile duration included): 23ms - 191ms
HHVM: 139ms - 414ms
PHP2371ms - 2383ms

2015-01-21

Ruby 2.1.5 vs 2.2.0 Performance Benchmark

Ruby 2.2.0 released last christmas (yea, I give you my heart~), and I ain't got any news about it (thanks to Google Alert) -_-|||, ok then let's do the benchmark, yay! :3

Benchmark FileInput Sizeruby-2.1.5 p273ruby-2.2.0 p0Performance Increase
macro-benchmarks/bm_gzip.rb1005.4418007875.529919291-1.62%
macro-benchmarks/bm_hilbert_matrix.rb100.0015066440.001508498-0.12%
macro-benchmarks/bm_hilbert_matrix.rb200.0180345140.019916750-10.44%
macro-benchmarks/bm_hilbert_matrix.rb300.0840658660.088421611-5.18%
macro-benchmarks/bm_hilbert_matrix.rb400.2433687390.257345416-5.74%
macro-benchmarks/bm_hilbert_matrix.rb500.6566729310.665158535-1.29%
macro-benchmarks/bm_hilbert_matrix.rb601.4833529251.499879964-1.11%
macro-benchmarks/bm_mpart.rb3000.0210451940.01858062311.71%
macro-benchmarks/bm_norvig_spelling.rb504.1056013593.8381815196.51%
macro-benchmarks/bm_parse_log.rb1000.5243118240.534461600-1.94%
macro-benchmarks/bm_rcs.rb1000.1673491930.167786871-0.26%
macro-benchmarks/bm_sudoku.rb11.3785271921.3097690034.99%
micro-benchmarks/bm_app_factorial.rb50000.0183778520.01631250311.24%
micro-benchmarks/bm_app_fib.rb300.1547457890.1451332626.21%
micro-benchmarks/bm_app_fib.rb351.7230136991.6511991024.17%
micro-benchmarks/bm_app_mandelbrot.rb10.1508939670.1480295441.90%
micro-benchmarks/bm_app_pentomino.rb120.91605014720.2193213553.33%
micro-benchmarks/bm_app_tak.rb70.1142748990.1081841895.33%
micro-benchmarks/bm_app_tak.rb80.3326020740.3119493296.21%
micro-benchmarks/bm_app_tak.rb90.8925922960.8139617978.81%
micro-benchmarks/bm_app_tarai.rb30.4186696320.3779541919.72%
micro-benchmarks/bm_app_tarai.rb40.5015455500.44657437710.96%
micro-benchmarks/bm_app_tarai.rb50.5704040660.5461785304.25%
micro-benchmarks/bm_binary_trees.rb17.6094919177.742826158-1.75%
micro-benchmarks/bm_cal.rb5000.0411283820.0409776420.37%
micro-benchmarks/bm_count_multithreaded.rb10.0043246640.005010469-15.86%
micro-benchmarks/bm_count_multithreaded.rb20.0091488980.010368676-13.33%
micro-benchmarks/bm_count_multithreaded.rb40.0217645230.01927901811.42%
micro-benchmarks/bm_count_multithreaded.rb80.0456799360.0413018249.58%
micro-benchmarks/bm_count_multithreaded.rb160.0792680710.091182084-15.03%
micro-benchmarks/bm_count_shared_thread.rb10.0404284740.042236155-4.47%
micro-benchmarks/bm_count_shared_thread.rb20.0454026220.0433190784.59%
micro-benchmarks/bm_count_shared_thread.rb40.0463385460.0459357780.87%
micro-benchmarks/bm_count_shared_thread.rb80.0594895940.05279723111.25%
micro-benchmarks/bm_count_shared_thread.rb160.0555088970.062376136-12.37%
micro-benchmarks/bm_dirp.rb100001.0411283391.069316017-2.71%
micro-benchmarks/bm_eval.rb10000006.4859326266.937864716-6.97%
micro-benchmarks/bm_fannkuch.rb60.0012134660.001289357-6.25%
micro-benchmarks/bm_fannkuch.rb80.0914047020.095585812-4.57%
micro-benchmarks/bm_fannkuch.rb1011.69747586712.100328001-3.44%
micro-benchmarks/bm_fasta.rb10000008.5766513358.3082399763.13%
micro-benchmarks/bm_ffi_printf.rb1000000.516967724LoadError
micro-benchmarks/bm_fiber_ring.rb100.0003083440.000332843-7.95%
micro-benchmarks/bm_fiber_ring.rb1000.0133686380.01180348011.71%
micro-benchmarks/bm_fiber_ring.rb10001.9420498531.50377529822.57%
micro-benchmarks/bm_fractal.rb50.5897041520.5393404538.54%
micro-benchmarks/bm_gc_array.rb113.64690203811.94584665612.46%
micro-benchmarks/bm_gc_mb.rb5000000.1384165340.09915606028.36%
micro-benchmarks/bm_gc_mb.rb10000000.2456715630.18143441026.15%
micro-benchmarks/bm_gc_mb.rb30000000.7683781830.66810086213.05%
micro-benchmarks/bm_gc_string.rb12.6184946072.5567723182.36%
micro-benchmarks/bm_knucleotide.rb10.5236778310.5175812411.16%
micro-benchmarks/bm_list.rb10000.0241720780.01986159917.83%
micro-benchmarks/bm_list.rb100000.9060837710.8696842404.02%
micro-benchmarks/bm_lucas_lehmer.rb96890.5232258070.5186681210.87%
micro-benchmarks/bm_lucas_lehmer.rb99410.5623396360.5538516051.51%
micro-benchmarks/bm_lucas_lehmer.rb112130.7501384740.7363778081.83%
micro-benchmarks/bm_lucas_lehmer.rb199372.9216229092.9178080620.13%
micro-benchmarks/bm_mandelbrot.rb17.5683576167.2822736563.78%
micro-benchmarks/bm_mbari_bogus1.rb10.0197005590.020653362-4.84%
micro-benchmarks/bm_mergesort.rb10.4296423510.4041294115.94%
micro-benchmarks/bm_mergesort_hongli.rb30000.6768509260.6738260030.45%
micro-benchmarks/bm_meteor_contest.rb13.8052915023.6300699594.60%
micro-benchmarks/bm_monte_carlo_pi.rb100000002.3594493022.1969672686.89%
micro-benchmarks/bm_nbody.rb1000000.8981084690.8978282680.03%
micro-benchmarks/bm_nsieve.rb92.1775391002.0563559065.57%
micro-benchmarks/bm_observ.rb1000000.3006297050.26813425210.81%
micro-benchmarks/bm_open_many_files.rb500000.2342404970.20007004614.59%
micro-benchmarks/bm_partial_sums.rb25000003.1756247892.9666651196.58%
micro-benchmarks/bm_pathname.rb10028.86605365629.000798768-0.47%
micro-benchmarks/bm_pi.rb10000.0318166700.0288376499.36%
micro-benchmarks/bm_pi.rb100002.7938742242.7282088132.35%
micro-benchmarks/bm_primes.rb30000.0008841000.0008343775.62%
micro-benchmarks/bm_primes.rb300000.0079500270.008346128-4.98%
micro-benchmarks/bm_primes.rb3000000.0770198550.078940931-2.49%
micro-benchmarks/bm_primes.rb30000000.7747306950.7652326571.23%
micro-benchmarks/bm_quicksort.rb10.9757187231.005529795-3.06%
micro-benchmarks/bm_read_large.rb1001.4458229041.4336912850.84%
micro-benchmarks/bm_regex_dna.rb201.6647405851.49271018010.33%
micro-benchmarks/bm_reverse_complement.rb12.2604946862.2190666741.83%
micro-benchmarks/bm_simple_connect.rb10.0001322510.00011614112.18%
micro-benchmarks/bm_simple_connect.rb1000.0033113020.0030900826.68%
micro-benchmarks/bm_simple_connect.rb5000.0163389400.0150205408.07%
micro-benchmarks/bm_simple_server.rb10.0001335030.000155542-16.51%
micro-benchmarks/bm_simple_server.rb1000.0009697070.00084697812.66%
micro-benchmarks/bm_simple_server.rb1000000.7293019840.6584448439.72%
micro-benchmarks/bm_so_ackermann.rb70.0405418650.0385931474.81%
micro-benchmarks/bm_so_ackermann.rb90.6496864580.6085772796.33%
micro-benchmarks/bm_so_array.rb90000.9828212220.9470421153.64%
micro-benchmarks/bm_so_count_words.rb1001.8701930481.7483349466.52%
micro-benchmarks/bm_so_exception.rb5000001.2383128231.1495423517.17%
micro-benchmarks/bm_so_lists.rb10002.1986860972.1147091633.82%
micro-benchmarks/bm_so_lists_small.rb10000.4533135950.4328647674.51%
micro-benchmarks/bm_so_matrix.rb600.3105549940.3086623030.61%
micro-benchmarks/bm_so_object.rb5000000.2440545830.254701496-4.36%
micro-benchmarks/bm_so_object.rb10000000.5101605330.523120809-2.54%
micro-benchmarks/bm_so_object.rb15000000.7860081950.787754481-0.22%
micro-benchmarks/bm_so_sieve.rb40004.9262801424.6936439554.72%
micro-benchmarks/bm_socket_transfer_1mb.rb100000.1383465710.07739996744.05%
micro-benchmarks/bm_socket_transfer_1mb.rb10000000.1382636570.07823478943.42%
micro-benchmarks/bm_socket_transfer_1mb_noblock.rb100000.1441793790.07864516845.45%
micro-benchmarks/bm_socket_transfer_1mb_noblock.rb10000000.1365246790.07641993144.02%
micro-benchmarks/bm_spectral_norm.rb1000.0875579860.0869018450.75%
micro-benchmarks/bm_string_concat.rb100000001.5728247591.39673948511.20%
micro-benchmarks/bm_sum_file.rb1002.4838524442.512043986-1.13%
micro-benchmarks/bm_word_anagrams.rb12.2992337622.2148209323.67%
micro-benchmarks/bm_write_large.rb1000.0947763400.0853874689.91%
rdoc/bm_rdoc_against_itself_darkfish.rb15.1562843784.49292330612.87%
rdoc/bm_rdoc_against_itself_ri.rb14.3977001244.0107925758.80%

So, as we could see, ruby-2.2.0 does bring new performance increase, especially in Socket and GCs.