Measure Which programming language is fastest?
My question is if anyone here has any experience with simplistic benchmarking and could tell me which things to test for in order to get a simple idea of each language's general performance?
There's more than one right
answer.
For some programs —
For some simple programs —
The current Ruby mandelbrot multicore programs are 7x faster than this simple Ruby transliteration and the exhaustively-optimised + multicore + vector-instruction C programs are more-like 25x faster than this simple C program.
| source code
| secs
| mem
| gz
|
|
|
| Intel C
| 23.49
| 19,736
| 433
|
|
|
| C gcc #2
| 24.96
| 19,520
| 412
|
|
|
| C gcc
| 26.23
| 19,520
| 433
|
|
|
| Go #2
| 26.63
| 19,696
| 500
|
|
|
| Go
| 27.63
| 19,696
| 469
|
|
|
| Java
| 29.62
| 43,712
| 445
|
|
|
| C# .NET
| 46.68
| 31,464
| 472
|
|
|
| PHP #3
| 161.27
| 19,396
| 418
|
|
|
| PHP #2
| 191.25
| 19,396
| 397
|
|
|
| PHP
| 201.46
| 19,396
| 390
|
|
|
| Java -Xint
| 8 min
| 34,972
| 445
|
|
|
| Ruby #2
| 19 min
| 21,504
| 313
|
|
|
| Ruby
| 20 min
| 21,248
| 341
|
|
|
| Python 3 #3
| 22 min
| 19,656
| 392
|
|
|
| Toit
| 26 min
| 19,644
| 387
|
|
|
| Python 3 #2
| 30 min
| 19,656
| 337
|
|
|
| Python 3
| 1h 11 min
| 19,656
| 380
|
|
|
| Matz's Ruby
| 2h 35 min
| 11,052
| 335
|
|
|
| Matz's Ruby #2
| 3h 13 min
| 11,056
| 307
|
|
|
Transliterations are not necessarily idiomatic
. When the Ruby #2 and Python #2 programs are most idiomatic
they are furthest from identical — are they similar-enough to be comparable for your purposes? (The Python #2 program uses a built-in complex-number type.)
The slightly-moderately-highly-wildly("I spent two weekends on this") optimised mandelbrot programs are not identical — does that matter for your purposes? And [pdf] As fast as C or As fast as SSE and AVX?
For more language implementations —
Answers & Questions, Criticism & Response —