Created
September 6, 2010 20:32
-
-
Save bga/567488 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Basic idea - measure cost of simplest operation of js in cpu cycles | |
asm | |
//var i = n; | |
mov EAX, n | |
// while(i--); | |
a: dec EAX | |
jnz a | |
in native x86 asm it costs 2 cycles | |
*/ | |
// cpuFreq - cpu frequency | |
(function(n) | |
{ | |
var d = new Date, i = n; | |
while(i--) | |
; | |
return (new Date - d)/1e3/n; | |
})(1e8)*cpuFreq; | |
/* | |
chrome7(v8) | |
~8 | |
opera 10.60(Carakan) | |
~14 | |
ie7(jscript5.7) | |
~168 | |
ff3.6(trace monkey) | |
~11 | |
ff4b3(Jaeger Monkey) | |
~8 | |
besen r120 | |
~33 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment