[ANN] Help with a LiveCode Presentation/Demo
Peter W A Wood
peterwawood at gmail.com
Wed Jun 5 02:54:16 EDT 2013
Kay
On 5 Jun 2013, at 14:07, Kay C Lan wrote:
> I notice that the claim of MetaCard being 30 times faster than
> JavaScript/Shell dates back to 1996. Since then I'm aware of at least 2
> major engine improvements to Rev/LC. Anyone have any idea of how much
> faster LC is today? Empirical evidence not required, best guesstimate fine
> by me.
I think it will always be the case that language performance is not generally uniform, some things will be faster in one language (eg arithmetic) whilst somethings will be slower (string handling). However, there have been quite unimaginable performance improvements in JavaScript over the past years and I would suspect that on the whole JavaScript executes "faster" than LiveCode.
Here's a little test that I ran in the Message Box, it concatenates 1,000,000 !s to Hello World:
put the long seconds into tStart
put "Hello World" into tHW
repeat for 1000000 times
put tHW & "!" into tHW
end repeat
put the long seconds into tEnd
put tEnd - tStart into tTimeTaken
put tTimeTaken
It took 82.607967 seconds on my machine.
Here's the equivalent in JavaScript:
var end;
var timeTaken;
var i;
var start = new Date().getTime();
var hw = 'hello';
for (i = 1; i < 1000000; i++) {
hw += '!';
}
end = new Date().getTime();
timeTaken = end - start;
print(timeTaken);
It took on average 145 milliseconds to run on my machine under Google's V8.
It may be a very poor test but it shows how much faster JavaScript can be when compared to LiveCode (and hence the dangers of such comparisons).
Hope your presentation goes well.
Peter
http://LiveCode1001.blogspot.com
More information about the use-livecode
mailing list