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:38,"IRIX Spin 6.3 IP32 mips"], version 20020528
 Executed d.d. Fri Jun 14 19:35:54 2002
 Input files: 'examples/benching.xg: Fri Jun 14 18:55:43 2002' 
 Working directory: /usr/people/bertin/work/src/xgraph
 Last opened on display bola.college-de-france.fr:0.0/-1/-1 (visual 0x24, 16 planes TrueColor) by bertin


1.00000e+06 times empty loop took 1.70437(real)/1.60000(user) sec [586728R/625000U]l/s seconds
1.00000e+06 times looping empty procedure took 3.83233(real)/3.78000(user) sec [260938R/264550U]l/s seconds
1.00000e+06 times looping empty procedure took 3.82108(real)/3.77000(user) sec [261706R/265252U]l/s seconds
Calibrating adapted loop size (should be 1s)... 261706 times looping empty procedure took 1.01060(real)/0.990000(user) sec [258962R/264350U]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 [261706] arrays in a scalar-addition loop, without support for simple array arithmetic: 4.09019(real)/3.98000(user) sec [63983.8R/65755.3U]l/s
	Result z==2  0
Addition of 2 [261706] arrays in a scalar-addition loop, with support for simple array arithmetic: 4.51529(real)/4.47000(user) sec [57960.0R/58547.2U]l/s
	Result z==2  0
Addition of 2 [261706] arrays with scalar-addition and Apply2Array, without support for simple array arithmetic: 1.83536(real)/1.81000(user) sec [142591R/144589U]l/s
	Result z==2  0
Addition of 2 [261706] arrays with scalar-addition and Apply2Array, with support for simple array arithmetic: 1.91076(real)/1.88000(user) sec [136965R/139205U]l/s
	Result z==2  0
Addition of a scalar to a [261706] array with scalar-addition, without support for simple array arithmetic: 3.88049(real)/3.81000(user) sec [67441.5R/68689.2U]l/s
	Result z==130854  75548.2
Addition of a scalar to a [261706] array with scalar-addition, with support for simple array arithmetic: 3.94774(real)/3.87000(user) sec [66292.6R/67624.3U]l/s
	Result z==130854  75548.2
Addition of a scalar to a [261706] array with scalar-addition and Apply2Array, without support for simple array arithmetic: 0.303204(real)/0.260000(user) sec [863135R/1.00656e+06U]l/s
	Result z==130854  75548.2
Addition of a scalar to a [261706] array with scalar-addition and Apply2Array, with support for simple array arithmetic: 0.372137(real)/0.430000(user) sec [703252R/608619U]l/s
	Result z==130854  75548.2
10x array[261706] addition without support for simple array arithmetic, array addition (add[&z,&x,&y]): 0.00222300(real)/0(user) sec [1.17726e+08R/InfU]l/s
	Result z==0  0
10x array[261706] addition with support for simple array arithmetic, array addition (add[&z,&x,&y]): 1.15402(real)/1.11000(user) sec [226777R/235771U]l/s
	Result z==2  0
261706x array[10] addition with support for simple array arithmetic, array addition: 3.71327(real)/3.57000(user) sec [70478.5R/73307.0U]l/s
	Result zz==5.50000  3.02765
procedure calling overhead compared to functions, $UseConstantsLists=1
261706 times v1,v2: 0.837861(real)/0.840000(user) sec [312350R/311555U]l/s
261706 times v1[v2],v2[v1]=120,120: 1.07230(real)/1.05000(user) sec [244062R/249244U]l/s
261706 times v[0],v[1]: 1.13006(real)/1.09000(user) sec [231586R/240097U]l/s
261706 times v[0,v1],v[1,v2]=100,120: 1.69008(real)/1.67000(user) sec [154848R/156710U]l/s
261706 times v[0,v1,v2]=100,120: 1.90010(real)/1.88000(user) sec [137733R/139205U]l/s
261706 times empty=0: 1.06814(real)/1.04000(user) sec [245012R/251640U]l/s
261706 times empty[v1,v2]=0: 1.62176(real)/1.63000(user) sec [161371R/160556U]l/s
261706 times add[v1,v2]=220: 2.07424(real)/2.03000(user) sec [126170R/128919U]l/s
261706 times add[v[0],v[1]]=220: 2.47810(real)/2.39000(user) sec [105607R/109501U]l/s
261706 times call[&add,v1,v2]=220: 2.38630(real)/2.30000(user) sec [109671R/113785U]l/s
261706 times sumvv=220: 2.31900(real)/2.34000(user) sec [112853R/111840U]l/s
261706 times sum[v1,v2]=220: 3.42511(real)/3.33000(user) sec [76408.0R/78590.4U]l/s
261706 times call[&sum,v1,v2]=220: 4.70855(real)/4.65000(user) sec [55581.1R/56280.9U]l/s
261706 times call[lambda[add[$[0],$[1]]],v1,v2]=220: 4.39771(real)/4.28000(user) sec [59509.7R/61146.3U]l/s

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

261706 times 2Dindex[1,2,3,4]: 2.60799(real)/2.60000(user) sec [100348R/100656U]l/s
261706 times nDindex[1,2,3,4]: 2.83225(real)/2.68000(user) sec [92402.1R/97651.5U]l/s
261706 times @[&zz,$loop]==-123.456: 2.66478(real)/2.64000(user) sec [98209.3R/99131.1U]l/s
261706 times @[`"1234567890"]==2.12044e+10 3.14583(real)/3.07000(user) sec [83191.6R/85246.3U]l/s

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

261706 times 'progn[2,add[2,kk]]' took 3.66968(real)/3.64000(user) sec [71315.8R/71897.3U]l/s seconds with $UseConstantsLists=0
261706 times 'progn[2,?add,?ran]' took 2.37424(real)/2.30000(user) sec [110228R/113785U]l/s seconds with $UseConstantsLists=0
261706 times 'progn[2,add[2,kk]]' took 3.60258(real)/3.57000(user) sec [72644.1R/73307.0U]l/s seconds with $UseConstantsLists=1
261706 times 'progn[2,?add,?ran]' took 2.20956(real)/2.15000(user) sec [118443R/121724U]l/s seconds with $UseConstantsLists=1
261706 times 'var[foo[?ran]]'=0.446584 took 3.60017(real)/3.48000(user) sec [72692.7R/75202.9U]l/s seconds with $UseConstantsLists=0
261706 times 'var[foo[?ran]]'=0.446584 took 1.27816(real)/1.33000(user) sec [204753R/196772U]l/s seconds with $UseConstantsLists=1
261706 times 'var'=0 took 0.941720(real)/0.840000(user) sec [277902R/311555U]l/s seconds with $UseConstantsLists=0
261706 times 'var'=0 took 0.711003(real)/0.720000(user) sec [368080R/363481U]l/s seconds with $UseConstantsLists=1
261706 times 'var[$loop]'=261705 took 2.21047(real)/2.16000(user) sec [118394R/121160U]l/s seconds with $UseConstantsLists=0
261706 times 'var[$loop]'=261705 took 0.860609(real)/0.840000(user) sec [304094R/311555U]l/s seconds with $UseConstantsLists=1
261706 times 'var[foo[$loop]]'=261705 took 3.42666(real)/3.43000(user) sec [76373.5R/76299.1U]l/s seconds with $UseConstantsLists=0
261706 times 'var[foo[$loop]]'=261705 took 1.41110(real)/1.34000(user) sec [185462R/195303U]l/s seconds with $UseConstantsLists=1
261706 times 'var[foo[bar[$loop]]]'=261705 took 4.64013(real)/4.60000(user) sec [56400.6R/56892.6U]l/s seconds with $UseConstantsLists=0
261706 times 'var[foo[bar[$loop]]]'=261705 took 2.59265(real)/2.49000(user) sec [100942R/105103U]l/s seconds with $UseConstantsLists=1
87235 times stats-test1 (ss10=8.008735.76897 ; sas10=4.005855.76897): 
	took 3.38074(real)/3.38000(user) sec [77411.0R/77427.8U]l/s seconds with $UseConstantsLists=0
87235 times stats-test2 (ss11=20.039314.7744 ; sas11=10.053014.7744): 
	took 4.86781(real)/4.69000(user) sec [53762.6R/55800.9U]l/s seconds with $UseConstantsLists=0
Ratios (should be 2.5): ss11/ss10=2.502182.56101 ; sas11/sas10=2.509582.56101
Now doing the same, using Apply2Array and array-passing:
87235 times stats-test3 (ss10=8.032245.77701 ; sas10=4.005865.77701): 
	took 1.34021(real)/1.38000(user) sec [195273R/189642U]l/s seconds with $UseConstantsLists=0
87235 times stats-test4 (ss11=20.024514.6799 ; sas11=9.9784914.6799): 
	took 2.48953(real)/2.39000(user) sec [105123R/109501U]l/s seconds with $UseConstantsLists=0
Ratios (should be 2.5): ss11/ss10=2.493022.54109 ; sas11/sas10=2.490972.54109
87235 times stats-test1 (ss10=8.026055.77526 ; sas10=4.004385.77526): 
	took 3.38877(real)/3.28000(user) sec [77227.5R/79788.4U]l/s seconds with $UseConstantsLists=1
87235 times stats-test2 (ss11=19.994514.7017 ; sas11=9.9879814.7017): 
	took 4.88725(real)/4.79000(user) sec [53548.7R/54635.9U]l/s seconds with $UseConstantsLists=1
Ratios (should be 2.5): ss11/ss10=2.491212.54563 ; sas11/sas10=2.494262.54563
Now doing the same, using Apply2Array and array-passing:
87235 times stats-test3 (ss10=8.027955.78130 ; sas10=4.011065.78130): 
	took 1.34038(real)/1.38000(user) sec [195248R/189642U]l/s seconds with $UseConstantsLists=1
87235 times stats-test4 (ss11=20.016914.7316 ; sas11=10.010314.7316): 
	took 2.48995(real)/2.38000(user) sec [105105R/109961U]l/s seconds with $UseConstantsLists=1
Ratios (should be 2.5): ss11/ss10=2.493402.54814 ; sas11/sas10=2.495682.54814
expression-loops per second (55 samples):
	261706/2.47576=105708 (real time)
	261706/2.42546=107900 (user time)
