Current file: examples/benching.xg: Mon Oct 14 10:34:47 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 2>/dev/null >pipe:[4102]  ## sh/bash notation
 XGraph build gcc[Oct  6 2002 17:00:00,"Linux bola 2.2.13-7mdk i686 unknown"], version 20021003
 Executed d.d. Mon Oct 14 10:35:10 2002
 Input files: 'examples/benching.xg: Mon Oct 14 10:34:47 2002' 
 Working directory: /home/bertin/work/src/xgraph
 Last opened on display :0.0/-1/-1 (visual 0x23, 16 planes TrueColor) by bertin


1.00000e+06 times empty loop took 0.371306(real)/0.370000(user) sec [2.69320e+06R/2.70270e+06U]l/s seconds
1.00000e+06 times looping empty procedure took 0.764943(real)/0.750000(user) sec [1.30729e+06R/1.33333e+06U]l/s seconds
1.00000e+06 times looping empty procedure took 0.749836(real)/0.750000(user) sec [1.33362e+06R/1.33333e+06U]l/s seconds
Calibrating adapted loop size (should be 1s)... 1.33362e+06 times looping empty procedure took 0.993960(real)/0.990000(user) sec [1.34173e+06R/1.34709e+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.33362e+06] arrays in a scalar-addition loop, without support for simple array arithmetic: 5.29987(real)/5.30000(user) sec [251634R/251627U]l/s
	Result z==2  0
Addition of 2 [1.33362e+06] arrays in a scalar-addition loop, with support for simple array arithmetic: 5.36407(real)/5.37000(user) sec [248622R/248347U]l/s
	Result z==2  0
Addition of 2 [1.33362e+06] arrays with scalar-addition and Apply2Array, without support for simple array arithmetic: 2.56811(real)/2.57000(user) sec [519303R/518920U]l/s
	Result z==2  0
Addition of 2 [1.33362e+06] arrays with scalar-addition and Apply2Array, with support for simple array arithmetic: 2.65115(real)/2.65000(user) sec [503036R/503254U]l/s
	Result z==2  0
Addition of a scalar to a [1.33362e+06] array with scalar-addition, without support for simple array arithmetic: 5.03194(real)/5.03000(user) sec [265032R/265134U]l/s
	Result z==666813  384984
Addition of a scalar to a [1.33362e+06] array with scalar-addition, with support for simple array arithmetic: 5.14201(real)/5.14000(user) sec [259358R/259460U]l/s
	Result z==666813  384984
Addition of a scalar to a [1.33362e+06] array with scalar-addition and Apply2Array, without support for simple array arithmetic: 0.430246(real)/0.430000(user) sec [3.09968e+06R/3.10145e+06U]l/s
	Result z==666813  384984
Addition of a scalar to a [1.33362e+06] array with scalar-addition and Apply2Array, with support for simple array arithmetic: 0.539305(real)/0.530000(user) sec [2.47286e+06R/2.51627e+06U]l/s
	Result z==666813  384984
10x array[1.33362e+06] addition without support for simple array arithmetic, array addition (add[&z,&x,&y]): 3.77000e-04(real)/0(user) sec [3.53746e+09R/InfU]l/s
	Result z==0  0
10x array[1.33362e+06] addition with support for simple array arithmetic, array addition (add[&z,&x,&y]): 1.36777(real)/1.36000(user) sec [975038R/980606U]l/s
	Result z==2  0
1.33362e+06x array[10] addition with support for simple array arithmetic, array addition: 4.98477(real)/4.98000(user) sec [267540R/267796U]l/s
	Result zz==5.50000  3.02765
procedure calling overhead compared to functions, $UseConstantsLists=1
1.33362e+06 times v1,v2: 0.834921(real)/0.830000(user) sec [1.59731e+06R/1.60678e+06U]l/s
1.33362e+06 times v1[v2],v2[v1]=120,120: 1.20225(real)/1.20000(user) sec [1.10927e+06R/1.11135e+06U]l/s
1.33362e+06 times v[0],v[1]: 1.79202(real)/1.79000(user) sec [744201R/745041U]l/s
1.33362e+06 times v[0,v1],v[1,v2]=100,120: 2.31239(real)/2.31000(user) sec [576729R/577327U]l/s
1.33362e+06 times v[0,v1,v2]=100,120: 2.52158(real)/2.52000(user) sec [528885R/529216U]l/s
1.33362e+06 times empty=0: 1.06791(real)/1.06000(user) sec [1.24882e+06R/1.25814e+06U]l/s
1.33362e+06 times empty[v1,v2]=0: 1.80711(real)/1.81000(user) sec [737988R/736809U]l/s
1.33362e+06 times add[v1,v2]=220: 2.54736(real)/2.55000(user) sec [523533R/522990U]l/s
1.33362e+06 times add[v[0],v[1]]=220: 3.14537(real)/3.15000(user) sec [423996R/423373U]l/s
1.33362e+06 times call[&add,v1,v2]=220: 3.22586(real)/3.22000(user) sec [413416R/414169U]l/s
1.33362e+06 times sumvv=220: 2.71353(real)/2.71000(user) sec [491473R/492112U]l/s
1.33362e+06 times sum[v1,v2]=220: 4.09318(real)/4.09000(user) sec [325816R/326070U]l/s
1.33362e+06 times call[&sum,v1,v2]=220: 0.816954(real)/0.810000(user) sec [1.63243e+06R/1.64645e+06U]l/s
1.33362e+06 times call[lambda[add[$[0],$[1]]],v1,v2]=220: 0.816487(real)/0.820000(user) sec [1.63337e+06R/1.62637e+06U]l/s

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

1.33362e+06 times 2Dindex[1,2,3,4]: 3.45310(real)/3.45000(user) sec [386211R/386558U]l/s
1.33362e+06 times nDindex[1,2,3,4]: 3.96813(real)/3.97000(user) sec [336084R/335926U]l/s
1.33362e+06 times @[&zz,$loop]==-123.456: 3.65734(real)/3.66000(user) sec [364644R/364378U]l/s
1.33362e+06 times @[`"1234567890"]==2.12044e+10 3.14186(real)/3.14000(user) sec [424470R/424721U]l/s

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

1.33362e+06 times 'progn[2,add[2,kk]]' took 4.52773(real)/4.53000(user) sec [294546R/294398U]l/s seconds with $UseConstantsLists=0
1.33362e+06 times 'progn[2,?add,?ran]' took 2.83630(real)/2.83000(user) sec [470199R/471245U]l/s seconds with $UseConstantsLists=0
1.33362e+06 times 'progn[2,add[2,kk]]' took 4.35338(real)/4.35000(user) sec [306342R/306580U]l/s seconds with $UseConstantsLists=1
1.33362e+06 times 'progn[2,?add,?ran]' took 2.62406(real)/2.63000(user) sec [508229R/507081U]l/s seconds with $UseConstantsLists=1
1.33362e+06 times 'var[foo[?ran]]'=0.176643 took 4.01520(real)/4.02000(user) sec [332144R/331747U]l/s seconds with $UseConstantsLists=0
1.33362e+06 times 'var[foo[?ran]]'=0.176643 took 1.42409(real)/1.43000(user) sec [936478R/932604U]l/s seconds with $UseConstantsLists=1
1.33362e+06 times 'var'=0 took 0.954605(real)/0.960000(user) sec [1.39704e+06R/1.38919e+06U]l/s seconds with $UseConstantsLists=0
1.33362e+06 times 'var'=0 took 0.753952(real)/0.760000(user) sec [1.76884e+06R/1.75477e+06U]l/s seconds with $UseConstantsLists=1
1.33362e+06 times 'var[$loop]'=1.33362e+06 took 2.50021(real)/2.50000(user) sec [533406R/533450U]l/s seconds with $UseConstantsLists=0
1.33362e+06 times 'var[$loop]'=1.33362e+06 took 0.914284(real)/0.910000(user) sec [1.45865e+06R/1.46552e+06U]l/s seconds with $UseConstantsLists=1
1.33362e+06 times 'var[foo[$loop]]'=1.33362e+06 took 4.04512(real)/4.05000(user) sec [329687R/329290U]l/s seconds with $UseConstantsLists=0
1.33362e+06 times 'var[foo[$loop]]'=1.33362e+06 took 1.41583(real)/1.42000(user) sec [941939R/939172U]l/s seconds with $UseConstantsLists=1
1.33362e+06 times 'var[foo[bar[$loop]]]'=1.33362e+06 took 5.57753(real)/5.57000(user) sec [239107R/239430U]l/s seconds with $UseConstantsLists=0
1.33362e+06 times 'var[foo[bar[$loop]]]'=1.33362e+06 took 2.96503(real)/2.96000(user) sec [449785R/450549U]l/s seconds with $UseConstantsLists=1
444541 times stats-test1 (ss10=7.999605.77076 ; sas10=3.996845.77076): 
	took 4.33665(real)/4.34000(user) sec [307524R/307287U]l/s seconds with $UseConstantsLists=0
444541 times stats-test2 (ss11=19.989314.7088 ; sas11=9.9889414.7088): 
	took 6.02864(real)/6.03000(user) sec [221215R/221165U]l/s seconds with $UseConstantsLists=0
Ratios (should be 2.5): ss11/ss10=2.498792.54885 ; sas11/sas10=2.499212.54885
Now doing the same, using Apply2Array and array-passing:
444541 times stats-test3 (ss10=7.994645.77435 ; sas10=3.998075.77435): 
	took 2.06924(real)/2.07000(user) sec [644499R/644263U]l/s seconds with $UseConstantsLists=0
444541 times stats-test4 (ss11=19.975414.7144 ; sas11=9.9954014.7144): 
	took 3.26267(real)/3.26000(user) sec [408753R/409087U]l/s seconds with $UseConstantsLists=0
Ratios (should be 2.5): ss11/ss10=2.498602.54823 ; sas11/sas10=2.500062.54823
444541 times stats-test1 (ss10=7.990485.77249 ; sas10=3.995355.77249): 
	took 4.31728(real)/4.32000(user) sec [308904R/308709U]l/s seconds with $UseConstantsLists=1
444541 times stats-test2 (ss11=19.994614.7101 ; sas11=10.000614.7101): 
	took 6.03165(real)/6.03000(user) sec [221104R/221165U]l/s seconds with $UseConstantsLists=1
Ratios (should be 2.5): ss11/ss10=2.502302.54831 ; sas11/sas10=2.503052.54831
Now doing the same, using Apply2Array and array-passing:
444541 times stats-test3 (ss10=7.994375.77436 ; sas10=3.994335.77436): 
	took 2.06906(real)/2.07000(user) sec [644557R/644263U]l/s seconds with $UseConstantsLists=1
444541 times stats-test4 (ss11=19.990514.7196 ; sas11=9.9953214.7196): 
	took 3.26097(real)/3.26000(user) sec [408965R/409087U]l/s seconds with $UseConstantsLists=1
Ratios (should be 2.5): ss11/ss10=2.500572.54913 ; sas11/sas10=2.502382.54913
expression-loops per second (55 samples):
	1.33362e+06/2.72110=490105 (real time)
	1.33362e+06/2.72018=490270 (user time)
