Current file: examples/benching.xg: Fri Jun 14 18:55:43 2002
A collection of timing benchmarks. Can take quite a while to complete, and doesn't generate
overly nice output! Performance measured in bogoflops, <err> I mean seconds :)
Current xgraph info:
 xgraph examples/benching.xg
 XGraph build gcc[Jun 14 2002 19:33:54,"Linux bola.college-de-france.fr 2.2.13-7mdk i686 unknown"], version 20020528
 Executed d.d. Fri Jun 14 19:36:52 2002
 Input files: 'examples/benching.xg: Fri Jun 14 18:55:43 2002' 
 Working directory: /home/bertin/work/src/xgraph
 Last opened on display :0.0/-1/-1 (visual 0x24, 16 planes TrueColor) by bertin


1.00000e+06 times empty loop took 0.370656(real)/0.340000(user) sec [2.69792e+06R/2.94118e+06U]l/s seconds
1.00000e+06 times looping empty procedure took 0.730826(real)/0.730000(user) sec [1.36831e+06R/1.36986e+06U]l/s seconds
1.00000e+06 times looping empty procedure took 0.729926(real)/0.730000(user) sec [1.37000e+06R/1.36986e+06U]l/s seconds
Calibrating adapted loop size (should be 1s)... 1.37000e+06 times looping empty procedure took 1.00230(real)/0.990000(user) sec [1.36686e+06R/1.38384e+06U]l/s seconds

timing of addition of 2 arrays, either with a for-toMAX[] loop construct (scalar addition), or
with (internal) array addition. The latter is done 10x to increase the reliability of the measured
duration. Procedures are used to ensure that the code is executed from compiled representations
(*EVAL* would not automatically compile the array-addition test procedure [test2]).
On a PIII 450Mhz (linux), test1 completes in around 5.8s, test2 under 1s (meaning that the array
addition is some 60x faster than the looped scalar addition).

Addition of 2 [1.37000e+06] arrays in a scalar-addition loop, without support for simple array arithmetic: 5.31385(real)/5.31000(user) sec [257817R/258004U]l/s
	Result z==2  0
Addition of 2 [1.37000e+06] arrays in a scalar-addition loop, with support for simple array arithmetic: 5.37437(real)/5.37000(user) sec [254914R/255121U]l/s
	Result z==2  0
Addition of 2 [1.37000e+06] arrays with scalar-addition and Apply2Array, without support for simple array arithmetic: 2.46724(real)/2.47000(user) sec [555278R/554656U]l/s
	Result z==2  0
Addition of 2 [1.37000e+06] arrays with scalar-addition and Apply2Array, with support for simple array arithmetic: 2.57343(real)/2.57000(user) sec [532363R/533074U]l/s
	Result z==2  0
Addition of a scalar to a [1.37000e+06] array with scalar-addition, without support for simple array arithmetic: 4.96789(real)/4.97000(user) sec [275771R/275654U]l/s
	Result z==685001  395485
Addition of a scalar to a [1.37000e+06] array with scalar-addition, with support for simple array arithmetic: 5.05196(real)/5.04000(user) sec [271182R/271826U]l/s
	Result z==685001  395485
Addition of a scalar to a [1.37000e+06] array with scalar-addition and Apply2Array, without support for simple array arithmetic: 0.376446(real)/0.380000(user) sec [3.63930e+06R/3.60527e+06U]l/s
	Result z==685001  395485
Addition of a scalar to a [1.37000e+06] array with scalar-addition and Apply2Array, with support for simple array arithmetic: 0.483324(real)/0.490000(user) sec [2.83454e+06R/2.79592e+06U]l/s
	Result z==685001  395485
10x array[1.37000e+06] addition without support for simple array arithmetic, array addition (add[&z,&x,&y]): 4.73000e-04(real)/0(user) sec [2.89641e+09R/InfU]l/s
	Result z==0  0
10x array[1.37000e+06] addition with support for simple array arithmetic, array addition (add[&z,&x,&y]): 1.14364(real)/1.15000(user) sec [1.19794e+06R/1.19131e+06U]l/s
	Result z==2  0
1.37000e+06x array[10] addition with support for simple array arithmetic, array addition: 4.10268(real)/4.10000(user) sec [333928R/334147U]l/s
	Result zz==5.50000  3.02765
procedure calling overhead compared to functions, $UseConstantsLists=1
1.37000e+06 times v1,v2: 0.857413(real)/0.850000(user) sec [1.59783e+06R/1.61177e+06U]l/s
1.37000e+06 times v1[v2],v2[v1]=120,120: 1.26416(real)/1.27000(user) sec [1.08372e+06R/1.07874e+06U]l/s
1.37000e+06 times v[0],v[1]: 1.83556(real)/1.84000(user) sec [746368R/744566U]l/s
1.37000e+06 times v[0,v1],v[1,v2]=100,120: 2.35747(real)/2.36000(user) sec [581131R/580509U]l/s
1.37000e+06 times v[0,v1,v2]=100,120: 2.35373(real)/2.35000(user) sec [582057R/582979U]l/s
1.37000e+06 times empty=0: 1.09373(real)/1.09000(user) sec [1.25259e+06R/1.25688e+06U]l/s
1.37000e+06 times empty[v1,v2]=0: 1.83528(real)/1.83000(user) sec [746480R/748635U]l/s
1.37000e+06 times add[v1,v2]=220: 2.41382(real)/2.41000(user) sec [567567R/568465U]l/s
1.37000e+06 times add[v[0],v[1]]=220: 3.31279(real)/3.31000(user) sec [413549R/413898U]l/s
1.37000e+06 times call[&add,v1,v2]=220: 2.72778(real)/2.73000(user) sec [502241R/501832U]l/s
1.37000e+06 times sumvv=220: 2.59618(real)/2.60000(user) sec [527699R/526924U]l/s
1.37000e+06 times sum[v1,v2]=220: 4.31847(real)/4.32000(user) sec [317242R/317130U]l/s
1.37000e+06 times call[&sum,v1,v2]=220: 6.11343(real)/6.12000(user) sec [224097R/223856U]l/s
1.37000e+06 times call[lambda[add[$[0],$[1]]],v1,v2]=220: 6.15874(real)/6.16000(user) sec [222448R/222403U]l/s

Comparing the special 2-D indexing function 2Dindex to nDindex

1.37000e+06 times 2Dindex[1,2,3,4]: 3.47160(real)/3.47000(user) sec [394631R/394813U]l/s
1.37000e+06 times nDindex[1,2,3,4]: 3.68707(real)/3.69000(user) sec [371570R/371274U]l/s
1.37000e+06 times @[&zz,$loop]==-123.456: 2.96294(real)/2.95000(user) sec [462379R/464407U]l/s
1.37000e+06 times @[`"1234567890"]==2.12044e+10 2.77026(real)/2.75000(user) sec [494540R/498182U]l/s

Some loops to time the effect of $UseConstantsLists (and the '?' last-value operator):

1.37000e+06 times 'progn[2,add[2,kk]]' took 4.19076(real)/4.19000(user) sec [326910R/326969U]l/s seconds with $UseConstantsLists=0
1.37000e+06 times 'progn[2,?add,?ran]' took 2.68610(real)/2.69000(user) sec [510034R/509294U]l/s seconds with $UseConstantsLists=0
1.37000e+06 times 'progn[2,add[2,kk]]' took 4.02088(real)/4.02000(user) sec [340722R/340796U]l/s seconds with $UseConstantsLists=1
1.37000e+06 times 'progn[2,?add,?ran]' took 2.50205(real)/2.50000(user) sec [547552R/548000U]l/s seconds with $UseConstantsLists=1
1.37000e+06 times 'var[foo[?ran]]'=0.176643 took 3.71535(real)/3.71000(user) sec [368741R/369273U]l/s seconds with $UseConstantsLists=0
1.37000e+06 times 'var[foo[?ran]]'=0.176643 took 1.38107(real)/1.38000(user) sec [991989R/992754U]l/s seconds with $UseConstantsLists=1
1.37000e+06 times 'var'=0 took 0.980594(real)/0.980000(user) sec [1.39711e+06R/1.39796e+06U]l/s seconds with $UseConstantsLists=0
1.37000e+06 times 'var'=0 took 0.763567(real)/0.770000(user) sec [1.79421e+06R/1.77922e+06U]l/s seconds with $UseConstantsLists=1
1.37000e+06 times 'var[$loop]'=1.37000e+06 took 2.33344(real)/2.33000(user) sec [587116R/587983U]l/s seconds with $UseConstantsLists=0
1.37000e+06 times 'var[$loop]'=1.37000e+06 took 0.969981(real)/0.970000(user) sec [1.41240e+06R/1.41237e+06U]l/s seconds with $UseConstantsLists=1
1.37000e+06 times 'var[foo[$loop]]'=1.37000e+06 took 3.71955(real)/3.72000(user) sec [368325R/368280U]l/s seconds with $UseConstantsLists=0
1.37000e+06 times 'var[foo[$loop]]'=1.37000e+06 took 1.33587(real)/1.34000(user) sec [1.02555e+06R/1.02239e+06U]l/s seconds with $UseConstantsLists=1
1.37000e+06 times 'var[foo[bar[$loop]]]'=1.37000e+06 took 5.07126(real)/5.07000(user) sec [270150R/270217U]l/s seconds with $UseConstantsLists=0
1.37000e+06 times 'var[foo[bar[$loop]]]'=1.37000e+06 took 2.79854(real)/2.80000(user) sec [489542R/489286U]l/s seconds with $UseConstantsLists=1
456667 times stats-test1 (ss10=7.999965.77147 ; sas10=3.996965.77147): 
	took 3.79226(real)/3.69000(user) sec [361262R/371274U]l/s seconds with $UseConstantsLists=0
456667 times stats-test2 (ss11=19.995714.7049 ; sas11=9.9907514.7049): 
	took 5.23458(real)/5.23000(user) sec [261721R/261951U]l/s seconds with $UseConstantsLists=0
Ratios (should be 2.5): ss11/ss10=2.499482.54787 ; sas11/sas10=2.499592.54787
Now doing the same, using Apply2Array and array-passing:
456667 times stats-test3 (ss10=7.997265.77595 ; sas10=4.000625.77595): 
	took 1.90842(real)/1.91000(user) sec [717870R/717278U]l/s seconds with $UseConstantsLists=0
456667 times stats-test4 (ss11=19.984014.7141 ; sas11=9.9940414.7141): 
	took 2.94345(real)/2.94000(user) sec [465440R/465987U]l/s seconds with $UseConstantsLists=0
Ratios (should be 2.5): ss11/ss10=2.498862.54747 ; sas11/sas10=2.498132.54747
456667 times stats-test1 (ss10=7.994195.77364 ; sas10=3.998555.77364): 
	took 3.68072(real)/3.68000(user) sec [372210R/372283U]l/s seconds with $UseConstantsLists=1
456667 times stats-test2 (ss11=19.993214.7131 ; sas11=9.9993414.7131): 
	took 5.23777(real)/5.24000(user) sec [261562R/261451U]l/s seconds with $UseConstantsLists=1
Ratios (should be 2.5): ss11/ss10=2.500972.54833 ; sas11/sas10=2.500742.54833
Now doing the same, using Apply2Array and array-passing:
456667 times stats-test3 (ss10=8.005305.76961 ; sas10=3.998085.76961): 
	took 1.90394(real)/1.91000(user) sec [719560R/717278U]l/s seconds with $UseConstantsLists=1
456667 times stats-test4 (ss11=19.985314.7136 ; sas11=9.9899414.7136): 
	took 2.94827(real)/2.94000(user) sec [464680R/465987U]l/s seconds with $UseConstantsLists=1
Ratios (should be 2.5): ss11/ss10=2.496512.55019 ; sas11/sas10=2.498692.55019
expression-loops per second (55 samples):
	1.37000e+06/2.74433=499213 (real time)
	1.37000e+06/2.74091=499835 (user time)
