The conditions are unfair: the C++ version uses double, whereas the Pharo version uses Integers. Change the C++ version to use int and then report the results :-).

Michal



On 17.12.2016 13:16, Dimitris Chloupis wrote:
So I was bored and decided to test how fast pharo is compared to C++.

so I tested addition

C++ version:

#include <stdio.h>

int main()
{
  double x=0;
  while(x<1000000000)
    {
    x = x+1;
    }

  return 1;
  }

 time ./test1
        2.84 real         2.84 user         0.00 sys

Pharo version:

time ./pharo Ephestos.image eval "|x| x := 0. 1 to: 1000000000 do:[:each| x := x +1]"
1
        2.09 real         1.94 user         0.08 sys

Pharo is +50% faster than C++ ... o_O ... that's suprising, I assume here Pharo VM probably does some kind of optimisation.


Reply via email to