Current file: examples/benching.xg: Fri Oct 24 17:55:12 2003
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:[31329]  ## sh/bash notation; escape as necessary!
 XGraph build version 20040109; gcc3.2.2[Jan  9 2004 21:52:13,"Linux bola 2.2.25 i686 unknown ; CC='gccopt -DXGRAPH ' ACC='gccopt -compiler gcc295.3 -inline -DXGRAPH '"]
 Executed d.d. Fri Jan  9 22:45:28 2004
 Input files: 'examples/benching.xg: Fri Oct 24 17:55:12 2003' 
 Working directory: /home/bertin/work/src/xgraph
 Last opened on display :0.0/-1/-1 (visual 0x23, 24 planes TrueColor) by bertin


1.00000e+06 times empty loop took 0.348666(real)/0.340000(user) sec [2.86807e+06R/2.94118e+06U]l/s seconds
1.00000e+06 times looping empty procedure took 0.770951(real)/0.760000(user) sec [1.29710e+06R/1.31579e+06U]l/s seconds
1.00000e+06 times looping empty procedure took 0.750569(real)/0.750000(user) sec [1.33232e+06R/1.33333e+06U]l/s seconds
Calibrating adapted loop size (should be 1s)... 1.33232e+06 times looping empty procedure took 1.04555(real)/1.05000(user) sec [1.27428e+06R/1.26888e+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.33232e+06] arrays in a scalar-addition loop, without support for simple array arithmetic: 5.58898(real)/5.59000(user) sec [238384R/238341U]l/s
	Result z==2  0
Addition of 2 [1.33232e+06] arrays in a scalar-addition loop, with support for simple array arithmetic: 5.99343(real)/5.94000(user) sec [222297R/224297U]l/s
	Result z==2  0
Addition of 2 [1.33232e+06] arrays with scalar-addition and Apply2Array, without support for simple array arithmetic: 3.29024(real)/3.25000(user) sec [404932R/409946U]l/s
	Result z==2  0
Addition of 2 [1.33232e+06] arrays with scalar-addition and Apply2Array, with support for simple array arithmetic: 4.08993(real)/4.03000(user) sec [325757R/330601U]l/s
	Result z==2  0
Addition of a scalar to a [1.33232e+06] array with scalar-addition, without support for simple array arithmetic: 5.25371(real)/5.25000(user) sec [253597R/253776U]l/s
	Result z==666162  384609
Addition of a scalar to a [1.33232e+06] array with scalar-addition, with support for simple array arithmetic: 5.68539(real)/5.60000(user) sec [234342R/237915U]l/s
	Result z==666162  384609
Addition of a scalar to a [1.33232e+06] array with scalar-addition and Apply2Array, without support for simple array arithmetic: 0.393647(real)/0.390000(user) sec [3.38457e+06R/3.41621e+06U]l/s
	Result z==666162  384609
Addition of a scalar to a [1.33232e+06] array with scalar-addition and Apply2Array, with support for simple array arithmetic: 0.712846(real)/0.710000(user) sec [1.86902e+06R/1.87651e+06U]l/s
	Result z==666162  384609
10x array[1.33232e+06] addition without support for simple array arithmetic, array addition (add[&z,&x,&y]): 3.94959e-04(real)/0(user) sec [3.37332e+09R/InfU]l/s
	Result z==0  0
10x array[1.33232e+06] addition with support for simple array arithmetic, array addition (add[&z,&x,&y]): 1.24047(real)/1.24000(user) sec [1.07405e+06R/1.07445e+06U]l/s
	Result z==2  0
1.33232e+06x array[10] addition with support for simple array arithmetic, array addition: 6.19223(real)/6.20000(user) sec [215160R/214891U]l/s
	Result zz==5.50000  3.02765
procedure calling overhead compared to functions, $UseConstantsLists=1
1.33232e+06 times v1,v2: 0.859854(real)/0.860000(user) sec [1.54948e+06R/1.54921e+06U]l/s
1.33232e+06 times v1[v2],v2[v1]=120,120: 1.23589(real)/1.24000(user) sec [1.07803e+06R/1.07445e+06U]l/s
1.33232e+06 times v[0],v[1]: 1.86471(real)/1.82000(user) sec [714495R/732046U]l/s
1.33232e+06 times v[0,v1],v[1,v2]=100,120: 2.38633(real)/2.38000(user) sec [558314R/559800U]l/s
1.33232e+06 times v[0,v1,v2]=100,120: 2.29141(real)/2.29000(user) sec [581442R/581801U]l/s
1.33232e+06 times empty=0: 1.08754(real)/1.09000(user) sec [1.22509e+06R/1.22231e+06U]l/s
1.33232e+06 times empty[v1,v2]=0: 1.87519(real)/1.87000(user) sec [710499R/712472U]l/s
1.33232e+06 times add[v1,v2]=220: 2.54506(real)/2.55000(user) sec [523495R/522480U]l/s
1.33232e+06 times add[v[0],v[1]]=220: 3.18327(real)/3.18000(user) sec [418539R/418970U]l/s
1.33232e+06 times call[&add,v1,v2]=220: 3.10799(real)/3.10000(user) sec [428677R/429782U]l/s
1.33232e+06 times sumvv=220: 3.79502(real)/3.80000(user) sec [351072R/350611U]l/s
1.33232e+06 times sum[v1,v2]=220: 5.29653(real)/5.30000(user) sec [251547R/251382U]l/s
1.33232e+06 times call[&sum,v1,v2]=220: 7.66171(real)/7.64000(user) sec [173894R/174388U]l/s
1.33232e+06 times call[lambda[add[$[0],$[1]]],v1,v2]=220: 7.59094(real)/7.55000(user) sec [175515R/176467U]l/s
1.33232e+06 times sum[v1,ran]=100.015: 6.68616(real)/6.67000(user) sec [199266R/199749U]l/s
1.33232e+06 times call[&sum,v1,ran]=100.966->100.205: 9.69381(real)/9.70000(user) sec [137441R/137353U]l/s

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

1.33232e+06 times 2Dindex[1,2,3,4]: 3.45019(real)/3.43000(user) sec [386160R/388432U]l/s
1.33232e+06 times nDindex[1,2,3,4]: 3.61699(real)/3.62000(user) sec [368351R/368045U]l/s
1.33232e+06 times @[&zz,$loop]==-123.456: 3.48420(real)/3.47000(user) sec [382390R/383955U]l/s
1.33232e+06 times @[`"1234567890"]==2.12044e+10 3.10973(real)/3.11000(user) sec [428438R/428400U]l/s

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

1.33232e+06 times 'progn[2,add[2,kk]]' took 4.63529(real)/4.64000(user) sec [287430R/287139U]l/s seconds with $UseConstantsLists=0
1.33232e+06 times 'progn[2,?add,?ran]' took 2.82158(real)/2.82000(user) sec [472191R/472455U]l/s seconds with $UseConstantsLists=0
1.33232e+06 times 'progn[2,add[2,kk]]' took 4.41232(real)/4.41000(user) sec [301955R/302114U]l/s seconds with $UseConstantsLists=1
1.33232e+06 times 'progn[2,?add,?ran]' took 2.63121(real)/2.62000(user) sec [506354R/508520U]l/s seconds with $UseConstantsLists=1
1.33232e+06 times 'var[foo[?ran]]'=0.0255017 took 4.01867(real)/4.01000(user) sec [331534R/332250U]l/s seconds with $UseConstantsLists=0
1.33232e+06 times 'var[foo[?ran]]'=0.0255017 took 1.30618(real)/1.29000(user) sec [1.02001e+06R/1.03281e+06U]l/s seconds with $UseConstantsLists=1
1.33232e+06 times 'var'=0 took 1.00022(real)/1(user) sec [1.33203e+06R/1.33232e+06U]l/s seconds with $UseConstantsLists=0
1.33232e+06 times 'var'=0 took 0.772522(real)/0.780000(user) sec [1.72464e+06R/1.70811e+06U]l/s seconds with $UseConstantsLists=1
1.33232e+06 times 'var[$loop]'=1.33232e+06 took 2.52234(real)/2.52000(user) sec [528209R/528700U]l/s seconds with $UseConstantsLists=0
1.33232e+06 times 'var[$loop]'=1.33232e+06 took 0.944990(real)/0.930000(user) sec [1.40988e+06R/1.43261e+06U]l/s seconds with $UseConstantsLists=1
1.33232e+06 times 'var[foo[$loop]]'=1.33232e+06 took 4.03728(real)/4.04000(user) sec [330005R/329783U]l/s seconds with $UseConstantsLists=0
1.33232e+06 times 'var[foo[$loop]]'=1.33232e+06 took 1.30539(real)/1.31000(user) sec [1.02063e+06R/1.01704e+06U]l/s seconds with $UseConstantsLists=1
1.33232e+06 times 'var[foo[bar[$loop]]]'=1.33232e+06 took 5.57576(real)/5.57000(user) sec [238949R/239196U]l/s seconds with $UseConstantsLists=0
1.33232e+06 times 'var[foo[bar[$loop]]]'=1.33232e+06 took 3.09228(real)/3.10000(user) sec [430854R/429782U]l/s seconds with $UseConstantsLists=1
444107 times stats-test1 (ss10=7.996095.77589 ; sas10=3.999105.77589): 
	took 3.73016(real)/3.73000(user) sec [357176R/357191U]l/s seconds with $UseConstantsLists=0
444107 times stats-test2 (ss11=19.973114.7051 ; sas11=9.9863414.7051): 
	took 5.47932(real)/5.48000(user) sec [243155R/243125U]l/s seconds with $UseConstantsLists=0
Ratios (should be 2.5): ss11/ss10=2.497862.54595 ; sas11/sas10=2.497152.54595
Now doing the same, using Apply2Array and array-passing:
444107 times stats-test3 (ss10=8.007765.76420 ; sas10=4.001925.76420): 
	took 2.23798(real)/2.24000(user) sec [595325R/594787U]l/s seconds with $UseConstantsLists=0
444107 times stats-test4 (ss11=19.997514.7035 ; sas11=9.9835514.7035): 
	took 3.19392(real)/3.18000(user) sec [417144R/418970U]l/s seconds with $UseConstantsLists=0
Ratios (should be 2.5): ss11/ss10=2.497272.55082 ; sas11/sas10=2.494692.55082
444107 times stats-test1 (ss10=7.999135.76941 ; sas10=3.998295.76941): 
	took 3.73210(real)/3.72000(user) sec [356990R/358151U]l/s seconds with $UseConstantsLists=1
444107 times stats-test2 (ss11=20.010714.7048 ; sas11=9.9909214.7048): 
	took 5.73323(real)/5.49000(user) sec [232386R/242682U]l/s seconds with $UseConstantsLists=1
Ratios (should be 2.5): ss11/ss10=2.501612.54875 ; sas11/sas10=2.498802.54875
Now doing the same, using Apply2Array and array-passing:
444107 times stats-test3 (ss10=8.014125.77659 ; sas10=4.004525.77659): 
	took 2.29655(real)/2.23000(user) sec [580141R/597454U]l/s seconds with $UseConstantsLists=1
444107 times stats-test4 (ss11=20.007514.7045 ; sas11=10.005914.7045): 
	took 3.20102(real)/3.19000(user) sec [416218R/417656U]l/s seconds with $UseConstantsLists=1
Ratios (should be 2.5): ss11/ss10=2.496532.54553 ; sas11/sas10=2.498662.54553
expression-loops per second (57 samples):
	1.33232e+06/3.24316=410811 (real time)
	1.33232e+06/3.22930=412574 (user time)
189.060 user_cpu 0.370 kernel_cpu 3:11.07 total_time 99.1%CPU {0W 0X 0D 0K 0M 1053F 11793R 0I 0O 0r 0s 0k 0w 0c}
