Status: New
Owner: ----
New issue 1704 by [email protected]: V8 significantly slower than Firefox
and Safari in evalutating Math functions.
http://code.google.com/p/v8/issues/detail?id=1704
Detailed description of the issue.
The V8 engine in Chrome evaluates the following 4 functions significantly
slower (upto 7X) than the Firefox and Safari Javascript engines. Also,
passing the Math.sin as a function argument results in a 3x speedup
compared to using the function inline (f1local vs. f2local).
This bug was reported by my friend Srikumar Subramanian, who encountered
this while writing audio processing code in JS.
https://plus.google.com/102694714835839603248/posts/i9dahgLDs9w
DETAILS
=======
f1 = function(n) { sum = 0; for (i = 0; i < n; ++i) sum += Math.sin(i);
return sum; }
f2 = function(f) { return function(n) { sum = 0; for (i = 0; i < n; ++i)
sum += f(i); return sum; } }
f1local = function(n) { var sum, i; sum = 0; for (i = 0; i < n; ++i) sum +=
Math.sin(i); return sum; }
f2local = function(f) { return function(n) { var sum, i; sum = 0; for (i =
0; i < n; ++i) sum += f(i); return sum; } }
Run on: Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz 4GB RAM Windows Vista
(3 years old)
Function f1(N) where N = 100M
40 sec in Firefox 6.0.2
94 sec in Safari 5.1 (7534.50)
275 sec in Chrome 14.0.835.163 beta-m (6X SLOWER)
Equivalent function f2(Math.sin)(N) where N = 100M
33 sec in Firefox 6.0.2
85 sec in Safari 5.1 (7534.50)
260 sec in Chrome 14.0.835.163 beta-m (7X SLOWER)
Function f1local(N) where N = 100M
23 sec in Firefox 6.0.2
28 sec in Safari 5.1 (7534.50)
45 sec in Chrome 14.0.835.163 beta-m (2X SLOWER)
Function f2local(Math.sin)(N) where N = 100M
17 sec in Firefox 6.0.2
13 sec in Safari 5.1 (7534.50)
15 sec in Chrome 14.0.835.163 beta-m
Bharat
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev