JaroslavTulach at 06:44, 16 December 2012 - 2012-12-16 06:44:14

←Older revision Revision as of 06:44, 16 December 2012
Line 30: Line 30:
i1 = arg1;
i1 = arg1;
i2 = arg2;
i2 = arg2;
-
return i1 + i2;
+
i1 += i2;
 +
return i1;
}
}
</source>
</source>

JaroslavTulach at 12:25, 14 December 2012 - 2012-12-14 12:25:54

←Older revision Revision as of 12:25, 14 December 2012
Line 36: Line 36:
Which is good enough for [[Chrome]]'s [[JavaScript]] virtual machine to swallow (and hence the ten times boost). [[Firefox]] probably does not optimize the unnecessary assignments well enough and thus the speed up was less dramatic.
Which is good enough for [[Chrome]]'s [[JavaScript]] virtual machine to swallow (and hence the ten times boost). [[Firefox]] probably does not optimize the unnecessary assignments well enough and thus the speed up was less dramatic.
-
PS: A thing to note is that originally (with the stack based approach) the [[Firefox]] was faster than [[Chrome]]. Looks like [[Chrome]] guys forgot to optimize for '''Array.push''' and '''Array.pop'''!
+
PS: A thing to note is that originally (with the stack based approach) the [[Firefox]] was faster than [[Chrome]]. Looks like [[V8]] guys forgot to optimize for '''Array.push''' and '''Array.pop'''!
PPS: Subjective measurements showed that [[Bck2Brwsr]] on [[V8]] runs the benchmark only four times slower compared to [[HotSpot]] - the real [[Java]]'s virtual machine.
PPS: Subjective measurements showed that [[Bck2Brwsr]] on [[V8]] runs the benchmark only four times slower compared to [[HotSpot]] - the real [[Java]]'s virtual machine.

JaroslavTulach at 12:25, 14 December 2012 - 2012-12-14 12:25:28

←Older revision Revision as of 12:25, 14 December 2012
Line 38: Line 38:
PS: A thing to note is that originally (with the stack based approach) the [[Firefox]] was faster than [[Chrome]]. Looks like [[Chrome]] guys forgot to optimize for '''Array.push''' and '''Array.pop'''!
PS: A thing to note is that originally (with the stack based approach) the [[Firefox]] was faster than [[Chrome]]. Looks like [[Chrome]] guys forgot to optimize for '''Array.push''' and '''Array.pop'''!
-
PPS: Measurements showed that [[Bck2Brwsr]] on [[V8]] runs the benchmark only four times slower compared to [[HotSpot]].
+
PPS: Subjective measurements showed that [[Bck2Brwsr]] on [[V8]] runs the benchmark only four times slower compared to [[HotSpot]] - the real [[Java]]'s virtual machine.

JaroslavTulach at 12:24, 14 December 2012 - 2012-12-14 12:24:43

←Older revision Revision as of 12:24, 14 December 2012
Line 37: Line 37:
PS: A thing to note is that originally (with the stack based approach) the [[Firefox]] was faster than [[Chrome]]. Looks like [[Chrome]] guys forgot to optimize for '''Array.push''' and '''Array.pop'''!
PS: A thing to note is that originally (with the stack based approach) the [[Firefox]] was faster than [[Chrome]]. Looks like [[Chrome]] guys forgot to optimize for '''Array.push''' and '''Array.pop'''!
 +
PPS: Measurements showed that [[Bck2Brwsr]] on [[V8]] runs the benchmark only four times slower compared to [[HotSpot]].
PPS: Measurements showed that [[Bck2Brwsr]] on [[V8]] runs the benchmark only four times slower compared to [[HotSpot]].

JaroslavTulach at 12:23, 14 December 2012 - 2012-12-14 12:23:45

←Older revision Revision as of 12:23, 14 December 2012
Line 37: Line 37:
PS: A thing to note is that originally (with the stack based approach) the [[Firefox]] was faster than [[Chrome]]. Looks like [[Chrome]] guys forgot to optimize for '''Array.push''' and '''Array.pop'''!
PS: A thing to note is that originally (with the stack based approach) the [[Firefox]] was faster than [[Chrome]]. Looks like [[Chrome]] guys forgot to optimize for '''Array.push''' and '''Array.pop'''!
-
PPS: Measurements showed that [[Bck2Brwsr]] on [[V8]] runs the benchmark only four times slower compared to [[Hotspot]].
+
PPS: Measurements showed that [[Bck2Brwsr]] on [[V8]] runs the benchmark only four times slower compared to [[HotSpot]].

JaroslavTulach at 12:23, 14 December 2012 - 2012-12-14 12:23:29

←Older revision Revision as of 12:23, 14 December 2012
Line 23: Line 23:
Congratulation Ľubomír!
Congratulation Ľubomír!
-
Of course the magic in in eliminating the stack and using normal local variables. At the end the code looks like:
+
Of course the magic is in eliminating the stack and using normal local variables. At the end the code looks like:
<source lang="javascript">
<source lang="javascript">
Line 37: Line 37:
PS: A thing to note is that originally (with the stack based approach) the [[Firefox]] was faster than [[Chrome]]. Looks like [[Chrome]] guys forgot to optimize for '''Array.push''' and '''Array.pop'''!
PS: A thing to note is that originally (with the stack based approach) the [[Firefox]] was faster than [[Chrome]]. Looks like [[Chrome]] guys forgot to optimize for '''Array.push''' and '''Array.pop'''!
 +
PPS: Measurements showed that [[Bck2Brwsr]] on [[V8]] runs the benchmark only four times slower compared to [[Hotspot]].

JaroslavTulach at 12:21, 14 December 2012 - 2012-12-14 12:21:56

←Older revision Revision as of 12:21, 14 December 2012
Line 21: Line 21:
[[Image:Bck2BrwsrRegistersChrome.png]]
[[Image:Bck2BrwsrRegistersChrome.png]]
-
Congratulation Ľubomír! Of course the magic in in eliminating the stack and using normal local variables. At the end the code looks like:
+
Congratulation Ľubomír!
 +
 
 +
Of course the magic in in eliminating the stack and using normal local variables. At the end the code looks like:
<source lang="javascript">
<source lang="javascript">

JaroslavTulach at 12:21, 14 December 2012 - 2012-12-14 12:21:21

←Older revision Revision as of 12:21, 14 December 2012
Line 11: Line 11:
</source>
</source>
-
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!
+
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 deal with the 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]]:
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]]:

JaroslavTulach at 12:10, 14 December 2012 - 2012-12-14 12:10:46

←Older revision Revision as of 12:10, 14 December 2012
Line 15: Line 15:
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]]:
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]]:
-
 
+
[[Image:Bck2BrwsrRegistersFirefox.png]]
and about 10x(!) faster on [[Chrome]]:
and about 10x(!) faster on [[Chrome]]:
 +
 +
[[Image:Bck2BrwsrRegistersChrome.png]]
 +
 +
Congratulation Ľubomír! Of course the magic in in eliminating the stack and using normal local variables. At the end the code looks like:
 +
 +
<source lang="javascript">
 +
function plus(arg1, arg2) {
 +
var i1, i2;
 +
i1 = arg1;
 +
i2 = arg2;
 +
return i1 + i2;
 +
}
 +
</source>
 +
 +
Which is good enough for [[Chrome]]'s [[JavaScript]] virtual machine to swallow (and hence the ten times boost). [[Firefox]] probably does not optimize the unnecessary assignments well enough and thus the speed up was less dramatic.
 +
 +
PS: A thing to note is that originally (with the stack based approach) the [[Firefox]] was faster than [[Chrome]]. Looks like [[Chrome]] guys forgot to optimize for '''Array.push''' and '''Array.pop'''!

JaroslavTulach: New page: 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: <source la... - 2012-12-14 12:01:00

New page: 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: <source la...

New page

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:

<source lang="javascript">
function plus(arg1, arg2) {
var stack = new Array();
stack.push(arg1);
stack.push(arg2);
stack.push(stack.pop() + stack.pop());
return stack.pop();
}
</source>

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]]: