'. '

Bck2BrwsrViaRegisters

From APIDesign

Revision as of 12:01, 14 December 2012 by JaroslavTulach (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Original implementation of Bck2Brwsr virtual machine used Java classical stack based operations. E.g. when one needed to sum two numbers we had to manipulate the stack:

function plus(arg1, arg2) {
  var stack = new Array();
  stack.push(arg1);
  stack.push(arg2);
  stack.push(stack.pop() + stack.pop());
  return stack.pop();
}

This is almost one to one translation of Java's bytecode, but obviously, this is not really fast. Instead of a single operation, we are asking the JavaScript engines to manipulate with stack six times!

On Dec 14, 2012 Ľubomír made a significant break through: after rewrite to register based system (thanks to analysis of stackmap information), our matrix benchmark got at least twice as fast on Firefox:


and about 10x(!) faster on Chrome:

Personal tools
buy