www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Multi-dimension array performance. - matrix_perf.zip

I posted this as part of a 'bug' earlier, but since that was not actually a
compiler bug (but one in my code ;), the performance part of it may have been
lost in the shuffle.

Attached are the .d and .cod files for both a 'for' and 'foreach' version of a
benchmark using dynamic int[][]'s.

Although the 'foreach' version is faster, both versions are significantly slower
than the equivalent for DMC.

Relative times are in the 'results' file.

BTW - Should I be posting these here, or in digitalmars.D?

Thanks,

Dave


begin 0644 matrix_perf.zip
M4$L#!!0````(``ZZ$#$.6B'X] 0``#\4```+`!4`;6%T<FEX,BYC;V155`D`
M`YN&(4&;AB%!57 $``````"M6%N/VDH,? [2_ >>*Q8%-L"4HSZ$!"2D?3 2
M?4"L*A1(%K+-!26AW?[[X[ED[J%L>R04)F./Q_;8GSU9/?M?G5-57B_.0^^?
M59HE_2_]/&JJ]'T\C!]ZSN5ZR-*CLP]G;-;;K'?+U$9!^7<Z6J7ISO>M/),\
MOV;-"JCTM_L!7,E[4Q7./H_20EH3)^?](3EI,TFA:,764`F7*BV:5R$PG#1I
MGE23K^2Y/S9EM=H%\J3 C?=%\O.8174MY +\NK?SAT]U$T]K,*HX>5%3IBL_
MVF6RO*BJHE]UTF1)<6K.#[V'WK`!HE,GISPI&F`%Z=<\<8+-G%!:!C`1E!C&
M41,)9OT`YK`^/CCN*#D/7->5'NU2)N90UT(*>6.$JE1W(.+&$Q`RQC+'$3QF
M3UAF9&XAF*<>9L:$CM>6665IA0I%F%JGXCK,TN)[61R38=,=778_WKM:=JA.
MPZZ%"*O/SG+Q+Q[GY0\\'"PWY+6^'AP8 C7H++%N\3A+(F<9;`>/[B XO\"B
M;X)CLQ;C<,T%A^O!2!""+1^CEN71'7M4V&#I;]O9^&=9Q?U+4_7%9 /72D4R
ME< 69,2U/$99YA1)5)%Y2P0SA:EY2)A'S="-)JZ`V1=X?$+?7F"=X/9U;C*[
M60^8`ZC9([<U.R2S41Q3SP=$FV-^(6L$(YY]BQ+G&?D/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1ZGFEW8\A'7GB]I_Q3QFE2FXH9
MKS)H<$H32(7;KC+P'=_+AU9I<F _C*Z+>*^MT98BD\UPPHY\8-Q65<?L+F`O
M;YO-;(4^`E]G:7_EP%X5A434=H=G4QV85!!%3:B_QC0:_RJ4DV3BA*<0-_?=
M.U.-.;*Q:T.[P.-RJ'QY Z6!I2N6_F.'Z"YFCX\,QWPAD`YEB8DLV0 /&'LQ
M=5;QY$+;D&\;&Y!<O+*?_\AC]7+\!E!+`P04````"``.NA`Q\1[9'M\```!H
M`0``!P`5`'1I;65R+F155`D``YN&(4&;AB%!57 $``````!=D$%KPS`,A>^!
M_`=1&-C09K###BN[;/2\0;/3&,.QE=8LC8,E9X?2_SXY8:2;P9>G3WI/\J<A
M1`9B5SG#N"T+ORC$T?>'OUI(W*2VQ2AR6=C.$$'M3QCA7!8 CX^>E(8S\$CP
M"`?DM_J9A5!Z"Y>9L4<3WS] UYF!T&5ZUJ?^$?^W+<67Q$^3.X1&J!Z_%^D*
M"TTU2'1NU0IN[JK[% AMZ!VMUBK/W^1P&F[!&F+E0FHZU+6W7_2*<3^AUZX1
M.<5>R50.^^DF2O_692.Q&N5V#[/ /G/J;+#.NPAVD?\#4$L!`A<#%````` `
M#KH0,0Y:(?CV!```/Q0```L`#0```````0```("!`````&UA=')I>#(N8V]D
M550%``.;AB%!57 ``%!+`0(7`Q0````(``ZZ$#$K<YB>' (``)`%```)``T`
M``````$```"` 30%``!M871R:7 R+F155`4``YN&(4%5>```4$L!`A<#%```
M`` `#KH0,9QTFK?/!```7!,```H`#0```````0```("!C <``&UA=')I>"YC
M;V155`4``YN&(4%5>```4$L!`A<#%````` `#KH0,8QQZMZD` ``W`8```H`
M#0```````0```("!F P``&UA=')I>"YC<'!55`4``YN&(4%5>```4$L!`A<#
M%````` `#KH0,1> ,J2N`0``0P0``` `#0```````0```("!>P\``&UA=')I
M>"YD550%``.;AB%!57 ``%!+`0(7`Q0````(`/RY$#&EI#6-#`(``$D$```'
M``T```````$```"` 601``!R97-U;'1S550%``-\AB%!57 ``%!+`0(7`Q0`
M```(`!6Z$#&YO!49\ ```.0!```%``T```````$```"` :H3``!4:6UE<E54
M!0`#J88A055X``!02P$"%P,4````"``.NA`Q\1[9'M\```!H`0``!P`-````
M```!```` ('4%```=&EM97(N9%54!0`#FX8A055X``!02P4&`````` `"``;
)` ``[14`````
`
end
Aug 16 2004