views:

423

answers:

2

Since the speed of the top Javascript engines seems to be on par, the next criteria is footprint. What are the code and data footprints of the leading javascript engines?

+2  A: 

squirrelfish should have the smallest footprint ( i remember i read somewhere that it uses a really simple translation table from JS code to native code), but if you want something very small you should look at earlier js engines (that dont use native code tables) as they interpret code as they go, and dont compile the whole thing according to the current machine.

I dont see the point of comparing js engines though as they are basically single-threaded(well new engines are multithreaded but this is from the new "highly-optimized" engines) and they are only loaded once, and then interpret megabytes of JS code... The speed is more important than size..even for mobile devices, because i dont expect a JS engine to use more than 1-2Mb of memory(even that is waaay too much in my opinion..) but the sum of JS scripts in a JS based page can easily pass that.

Quamis
any reference URLs for squirrelfish having smaller footprint ?
vprajan
Quamis
A: 

V8 is the best engine AFAIK with higher performance metrics which has smaller memory footprint. V8 loads each JS objects based on the context into the memory and also uses generational garbage collector which means more runtime memory gets collected with lesser performance overhead.

If you mean code and data size as plain binary size, V8 beats most of the current high performing engines with just KBs of binary size.

In V8, all built-in objects like array, math etc are also JS files which gets dynamically loaded. Since build-in objects are very light-weight when it resides on a VM, we can also make it as static code if more performance is required with some sacrifice of memory.

vprajan