Hello.
Well. I modified the code, and generated the data into a list, and now the results are pointing towards the mod operator as the best way to take the modulus, or reduce a number.
Script Debugger returned this as the result of the code below.
script o
property l : {}
end script
repeat with i from 1 to 6000
set end of o's l to (random number) * 100 * 360
end repeat
set t0 to (current date)
repeat with i from 1 to 6000
set a to (item i of o's l) mod 360
end repeat
set t1 to (current date) - t0
For the one with the rev function, this was returned:
And here is the code.
script o
property l : {}
end script
repeat with i from 1 to 6000
set end of o's l to (random number) * 100 * 360
end repeat
set t0 to (current date)
repeat with i from 1 to 6000
set a to rev(item i of o's l)
end repeat
set t1 to (current date) - t0
on rev(x)
return x - ((x div 360.0) * 360.0)
end rev
The former reports from Script Debugger was something like this for the modulus:
And something like this for the one with the rev function.
But the times obtained by the date function in seconds reported grossly 50% less time for the last one, than for the former. (Both with the random number directly in the calls.)
Iāll have to do some more measures, when it comes to osaxen calls with the modulus, and the rev() handler, but that the modulus handler is unsurpassed, when it comes to just processing a list of numbers, (which is something I canāt recall ever have done).
I may not like it, but it is most probable, that Script Debugger has the correct timing, I just donāt understand the disagreement with Script Debugger and the result of the date handler. It may very well be that I just started the script at odd places towards a second though.