Is your program fast enough?

smash on 2008-04-11T18:48:09

In the process of submitting an article to about Parrot, we felt the urge to do some simple benchmarking, to have a glimpse of Parrot's current performance.

First, the facts:
1) We created a very dumb algorithm (intentionally not efficient) to calculate how may prime numbers exist between 1 and a given argument.
2) We implemented this algorithm in several well know interpreted languages, in Parrot of course, and also in C and Java to have a bottom line to draw comparisons. Basically we only used whiles and ifs and tried to make all implementations as similar as possible.
3) We run every program (unfortunately on a slow machine) several times, incrementing the argument in steps of 10000, from 10000 to 90000, and watched has they took more and more time to run.

Finally, check the results: .


Obligatory comment on behalf of petdance

hex on 2008-04-11T20:36:43

s/script/program/g; # :)

Vertical scale

bart on 2008-04-13T16:57:01

Could you please make the vertical scale logarithmic instead of linear? Now it's simply impossible to see how Java and C, which seem to be pretty close to each other, stack up against the rest.

With a logarithmic scale, I'd expect the lines for the various systems to become parallel to each other — although not necessarily straight — as long as the speed ratios when comparing the platforms, remain constant.

Re:Vertical scale

smash on 2008-04-13T19:41:13

Sure, you can check the result with a vertical log scale here: http://nrc.homelinux.org/parrot/primes_logscale.png