An interesting programming challenge
Colin Holgate
colinholgate at gmail.com
Sat Apr 11 13:56:52 EDT 2015
May have unearthed a reason for Javascript being so fast. If I run the same routine as ActionScript (the syntax is identical to Javascript for this example), the routine takes around 380 milliseconds. Still doing a good as LiveCode. But, if I change the list of numbers to be a Vector instead of an Array (a Vector is a typed array), the time comes down to 10 milliseconds.
This suggests that Javascript is assuming that the entries in the array are integers, whereas LiveCode and ActionScript are having to work out that the entries are numbers. Between treating the array as a set of integers, and Safari perhaps running Javascript faster than Flash Player runs ActionScript, that could account for the speed difference.
There’s some relevance to LiveCode too, in that with the new code in LiveCode 8, variables will need to be typed, and that could lead to a speed up for these kinds of tasks.
More information about the use-livecode
mailing list