Status: Accepted
Owner: [email protected]
Labels: Type-FeatureRequest Priority-Medium
New issue 1201 by [email protected]: Better crankshaft support for using a
value as both a double and integer in a loop
http://code.google.com/p/v8/issues/detail?id=1201
When we use a integer loop variable as a double inside a function we do a
lot of extra conversion back and forward. Below is an example of the same
functionality in two different versions:
function foo() {
for (var j = 0; j < 100000000; j = j + 1) {
a = j * 2.1;
}
}
function foo() {
for (var j = 0; j < 100000000; j = j + 1) {
var j2 = j + 0;
a = j2 * 2.1;
}
}
On ia32 this takes 559 and 402 ms respectively, i.e., introducing an extra
variable and assigning j+0 to it will give us a big performance improvement
(we need to add 0 otherwise this will not change anything since j will just
be used in place of j2).
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev