As far as I can see you're not doing a lot, but repeating that often. In a sense I'd thing you're actually timing "repeat with <var> = 1 to <var>" vs. "repeat for <var>", instead of in what ways arrays change the math operations. Do the same test with the same math operation in the loops, does that yield the same result? Whatever you did to your code, I think it makes it hard to read, and I certainly can't copy paste that to do my own tests.
On 25.01.2014, at 07:31, Geoff Canyon <gcan...@gmail.com> wrote: > 10 11.326327 0.710837 15.933786 > > 100 11.854238 0.662299 17.898622 > > 1000 12.105847 0.698076 17.341732 > > 10000 12.502957 0.773339 16.167497 > > 100000 13.145294 0.813667 16.155618 > > 1000000 12.737516 0.886334 14.371008 > > I ran the code below and got those numbers. I had assumed that array math > would be faster than iterating manually, and it is, but I also assumed that > the speed difference would increase for larger arrays, and it doesn't -- > the array math is about 16 times faster, almost regardless of the array > size. > > Oddly, on a different Macbook, the ratio was about 6, again for multiple > sizes of the target array. Not sure why that would be. > > *on* mouseUp > > *repeat* with arrayLog = 1 to 6 > > *put* 10^arrayLog into arrayCount > > *put* 10^(7 - arrayLog) into repeatLoopCount > > *repeat* with i = 1 to arrayCount > > *put* random(100) into X[i] > > *put* random(10) into Y[i] > > *end* *repeat* > > *put* the long seconds into T > > *repeat* repeatLoopCount > > *repeat* with i = 1 to arrayCount > > *add* Y[i] to X[i] > > *end* *repeat* > > *end* *repeat* > > *put* the long seconds - T into T1 > > *put* the long seconds into T > > *repeat* repeatLoopCount > > *add* Y to X > > *end* *repeat* > > *put* the long seconds - T into T2 > > *put* arrayCount && T1 && T2 && T1 / T2 & cr after R > > *delete* variable X > > *delete* variable Y > > *end* *repeat* > > *put* R > > *end* mouseUp > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode -- Use an alternative Dictionary viewer: http://bjoernke.com/bvgdocu/ Chat with other RunRev developers: http://bjoernke.com/chatrev/ _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode