Status: New
Owner: ----

New issue 2648 by yukoba: Using i = (i + 1) | 0 on loop variable is slow on ARM
http://code.google.com/p/v8/issues/detail?id=2648

Following benchmark 1 and benchmark 2 should run by the same speed,
but benchmark 2 is very slow on Chrome 27 on ARM. V8 is 3.17.6.8.

I changed it from "i++" to "i = (i + 1) | 0".

This does not happen on Chrome 27 (x86), Firefox 21 (x86 or ARM) or Safari (iOS).

Benchmark 1 (Snapdragon S3)
Chrome 27: 1200ms
Firefox 21: 1600ms

Benchmark 2 (Snapdragon S3)
Chrome 27: 9950ms
Firefox 21: 1600ms

I checked this also happens on Tegra 3 and Exynos 4.

function benchmark1() {
    var sum = 0;
    for (var i = 0; i < 200; i++) {
        for (var j = 0; j < 1000000; j++) {
            sum = (sum + j) | 0;
        }
    }
    return sum;
}

function benchmark2() {
    var sum = 0;
    for (var i = 0; i < 200; i = (i + 1) | 0) {
        for (var j = 0; j < 1000000; j++) {
            sum = (sum + j) | 0;
        }
    }
    return sum;
}


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to