Introduction Languages Documentation News Implementations Scorecard Recent Changes Mailing List Wiki Alioth

Array Access

[cpu minus startup time]
    [sort] [sort]  
Source Code CPU (sec) Mem (KB) Lines Code Log
gcc0.023036417log out
se0.024041245log out
g++0.024082814log out
bigloo0.039094018log out
stalin0.039072023log out
ocaml0.04305406log out
oberon20.0480116019log out
clean0.053060418log out
mlton0.066062825log out
slang0.07808809log out
felix0.083087219log out
gnat0.1700108029log out
cmucl0.1740463217log out
sbcl0.1940567217log out
nice0.201053889log out
gcj0.2020550413log out
chicken0.2200103618log out
smlnj0.2440125636log out
java0.2700721213log out
kaffe0.3080606013log out
poly0.4619241639log out
gforth0.500980811log out
ghc1.4548103621log out
sablevm1.8157290013log out
pop112.3626495223log out
fpascal2.51962960log out
ocamlb2.56467526log out
gij2.82161040013log out
pike3.2265298411log out
oz3.2915264025log out
rep3.4865100416log out
mercury3.8714519638log out
gst4.058439047log out
lua4.4093137613log out
xemacs5.4442776013log out
hipe5.5722444026log out
python6.1531230012log out
psyco6.1951230014log out
erlang6.2011441226log out
poplisp7.83781389615log out
mzc9.0546338018log out
icon9.4706200011log out
perl9.5395190010log out
newlisp10.2334120415log out
guile17.3774196415log out
php19.757047449log out
mzscheme20.3479340018log out
tcl20.3649345612log out
gawk25.480121288log out
ruby26.8429155612log out
mawk27.185911808log out
nhc98288.729115680413log out

Languages that compile to native code are in Bold Italics.


[Note: Values have been normalized to fall in the range of 0-10 for aesthetic reasons. Original value ranges are included on the X-axis.]

Click here for more detailed data and graphs.

[Results last updated: Fri Oct 15 23:56:42 2004 CDT]


About this test

For this test, each program should be implemented in the same way.

Originally this test was pretty much the same as the array test from Timing Trials, or, the Trials of Timing: Experiments with Scripting and User-Interface Languages by Brian W. Kernighan and Christopher J. Van Wyk. My original implementation of this test was pretty close to the Kernighan and Wyk version. I also did an experiment of manually unrolling the loop around the array. These two versions of the test are now obsoleted and superceded by this page.

This test is supposed to just test array access via subscripting. However, the original test didn't take into account array initilization overhead, and so in this version we create an array and then re-use it many times.

Note that one loop counts down from the end of the array to the beginning. This is to give the advantage to a random-access data structure, as an array should be, and not just any sequence data structure, as such as a list.

The correct output (for N = 1000) looks like this:

  1000 1000000