MartyConnelly
martyconnelly at shaw.ca
Mon Oct 31 10:39:20 CST 2005
Just one hint for VBA code speed on this line Since everything is being done by integers If alngTmp(lngItem, 1) / 10 = 100 Then On a run of 50 seconds If I use integer division with the "\" operator , I save around 1 second If alngTmp(lngItem, 1) \ 10 = 100 Then If I use multiplication instead of division , I save 5-6 seconds It does a type conversion to a long, but I have never seen a full documented description of this from MS so I don't trust it, so I would use CLng which would add overhead. If alngTmp(lngItem, 1) * 0.1 = 100 Then Some optimizing compilers have options that might change division by a constant to multiplication of it's inverse. Gustav Brock wrote: >Hi Stuart > >Thanks! This is a bit surprising, I had expected it to run faster. > >/gustav > > > >>>>stuart at lexacorp.com.pg 31-10-2005 03:41:55 >>> >>>> >>>> >On 30 Oct 2005 at 21:16, Gustav Brock wrote: > > > >>The DLL was programmed and compiled in FreeBASIC and the FBIde which I earlier posted links for. >> >>Setting lngLoopMax to 10^6 returns these running times for the two functions: >> >> ArrayTimeLocal: 34 seconds >> ArrayTimeDLL: 2.2 seconds (measured with 10^7 loops) >> >>Thus this simple tool gives a speed improvement of 15.5 to 1 ... not bad! >> >> >... > > >>Still, if anyone with PowerBasic or other compiler could make similar tests and publish the results, >> >> > >On my machine with the same code compiled to DLL in PowerBasic: > >ArrayTimeLocal: 27 (10^6) >ArrayTimeDLL: 2.7 (actually 27 secs for 10^7) > >An improvement of 10:1 . > >Looks like for this set of operations FreeBASIC does a better job than >PowerBASIC. > > -- Marty Connelly Victoria, B.C. Canada