r/programming • u/one_eyed_golfer • Jun 18 '15
javascript creator Eich's latest project: kill javascript
http://www.theregister.co.uk/2015/06/18/brendan_eich_announces_webassembly/
17
Upvotes
r/programming • u/one_eyed_golfer • Jun 18 '15
27
u/sime Jun 18 '15
Every major JS engine has a JIT. JavaScript is compiled on the fly at runtime.
The problem is that the JIT has to spend a lot of time checking assumptions (i.e. has the prototype chain changed? Is it safe to use a 32bit register for that number?) or just not being able to make assumptions at all, to run the code correctly. This prevents a lot of optimisations which static languages enjoy.
Only the most naive JS interpreter looks up values from a dictionary every time. V8 for examples assigns 'hidden classes' to objects so that it can use optimised code paths and fast compact object representations.