pmalek
6/1/2015 - 7:53 PM

python vs pypy comparison benchmarks using Python 2.7.6 and PyPy 2.5.1

python vs pypy comparison benchmarks using Python 2.7.6 and PyPy 2.5.1

Python 2.7.6
Using arena file:
    example_benchmarks/zeros.py
        - zeros_imul
        - zeros_mul
        - zeros_repeat
        - zeros_slow

Using benchmark file:
    example_benchmarks/bench_zeros.py
        - bench_empty
        - bench_large
        - bench_small

bench_empty - (example_benchmarks/bench_zeros.py)
  example_benchmarks/zeros.py
     144 nsec - zeros_imul - (2^21 = 2097152 loops)
     137 nsec - zeros_mul - (2^21 = 2097152 loops)
     430 nsec - zeros_repeat - (2^20 = 1048576 loops)
     163 nsec - zeros_slow - (2^21 = 2097152 loops)

bench_large - (example_benchmarks/bench_zeros.py)
  example_benchmarks/zeros.py
    32.8 usec - zeros_imul - (2^13 = 8192 loops)
    35.5 usec - zeros_mul - (2^13 = 8192 loops)
    38.6 usec - zeros_repeat - (2^13 = 8192 loops)
     220 usec - zeros_slow - (2^11 = 2048 loops)

bench_small - (example_benchmarks/bench_zeros.py)
  example_benchmarks/zeros.py
     228 nsec - zeros_imul - (2^21 = 2097152 loops)
     193 nsec - zeros_mul - (2^21 = 2097152 loops)
     521 nsec - zeros_repeat - (2^19 = 524288 loops)
     496 nsec - zeros_slow - (2^19 = 524288 loops)

**Benchmarks:** example_benchmarks/bench_zeros.py
**Functions:** example_benchmarks/zeros.py

**Time:**

|__Bench__ \ __Func__ | ___imul__ | ___mul__ | ___repeat__ | ___slow__ |
| -------------------:|:---------:|:--------:|:-----------:|:---------:|
|    __empty__ (`ns`) |   *144*   | __137__  |     430     |    163    |
|    __large__ (`us`) |  __32.8__ |  *35.5*  |     38.6    |    220    |
|    __small__ (`ns`) |   *228*   | __193__  |     521     |    496    |

**Relative time:**

|__Bench__ \ __Func__ | ___imul__ | ___mul__ | ___repeat__ | ___slow__ |
| -------------------:|:---------:|:--------:|:-----------:|:---------:|
|           __empty__ |   *1.05*  |  __1__   |     3.15    |    1.2    |
|           __large__ |   __1__   |  *1.08*  |     1.18    |    6.72   |
|           __small__ |   *1.18*  |  __1__   |     2.7     |    2.57   |

**Rank:**

|__Bench__ \ __Func__ | ___imul__ | ___mul__ | ___repeat__ | ___slow__ |
| -------------------:|:---------:|:--------:|:-----------:|:---------:|
|           __empty__ |    *2*    |  __1__   |      4      |     3     |
|           __large__ |   __1__   |   *2*    |      3      |     4     |
|           __small__ |    *2*    |  __1__   |      4      |     3     |
Python 2.7.9 (2.5.1+dfsg-1~ppa1+ubuntu14.04, Mar 27 2015, 19:19:42)
[PyPy 2.5.1 with GCC 4.8.2]
Using arena file:
    example_benchmarks/zeros.py
        - zeros_imul
        - zeros_mul
        - zeros_repeat
        - zeros_slow

Using benchmark file:
    example_benchmarks/bench_zeros.py
        - bench_empty
        - bench_large
        - bench_small

bench_empty - (example_benchmarks/bench_zeros.py)
  example_benchmarks/zeros.py
    9.17 nsec - zeros_imul - (2^25 = 33554432 loops)
    0.399 nsec - zeros_mul - (2^30 = 1073741824 loops)
    20.4 nsec - zeros_repeat - (2^24 = 16777216 loops)
    0.399 nsec - zeros_slow - (2^30 = 1073741824 loops)

bench_large - (example_benchmarks/bench_zeros.py)
  example_benchmarks/zeros.py
    3.93 usec - zeros_imul - (2^16 = 65536 loops)
    5.83 usec - zeros_mul - (2^16 = 65536 loops)
    17.1 usec - zeros_repeat - (2^14 = 16384 loops)
    16.7 usec - zeros_slow - (2^14 = 16384 loops)

bench_small - (example_benchmarks/bench_zeros.py)
  example_benchmarks/zeros.py
    15.8 nsec - zeros_imul - (2^24 = 16777216 loops)
    15.5 nsec - zeros_mul - (2^24 = 16777216 loops)
    39.3 nsec - zeros_repeat - (2^23 = 8388608 loops)
    56.2 nsec - zeros_slow - (2^23 = 8388608 loops)

**Benchmarks:** example_benchmarks/bench_zeros.py
**Functions:** example_benchmarks/zeros.py

**Time:**

|__Bench__ \ __Func__ | ___imul__ | ___mul__ | ___repeat__ | ___slow__ |
| -------------------:|:---------:|:--------:|:-----------:|:---------:|
|    __empty__ (`ns`) |    9.17   | *0.399*  |     20.4    | __0.399__ |
|    __large__ (`us`) |  __3.93__ |  *5.83*  |     17.1    |    16.7   |
|    __small__ (`ns`) |   *15.8*  | __15.5__ |     39.3    |    56.2   |

**Relative time:**

|__Bench__ \ __Func__ | ___imul__ | ___mul__ | ___repeat__ | ___slow__ |
| -------------------:|:---------:|:--------:|:-----------:|:---------:|
|           __empty__ |     23    |   *1*    |     51.2    |   __1__   |
|           __large__ |   __1__   |  *1.48*  |     4.35    |    4.25   |
|           __small__ |   *1.02*  |  __1__   |     2.53    |    3.62   |

**Rank:**

|__Bench__ \ __Func__ | ___imul__ | ___mul__ | ___repeat__ | ___slow__ |
| -------------------:|:---------:|:--------:|:-----------:|:---------:|
|           __empty__ |     3     |   *2*    |      4      |   __1__   |
|           __large__ |   __1__   |   *2*    |      4      |     3     |
|           __small__ |    *2*    |  __1__   |      3      |     4     |