Status: Accepted
Owner: ----
CC: [email protected]
Labels: Type-Bug Priority-Medium

New issue 3824 by [email protected]: Typed array maps should potentially be immortal
https://code.google.com/p/v8/issues/detail?id=3824

The code below runs almost two times faster if line marked with (*) is uncommented.

This happens because without that line GC constantly collects Typed Array map, discards optimized version of the sieve and clears weak cell that contains type feedback Data[i] keyed access sites.

When later sieve becomes hot again OSR happens in the first loop. At this point second loop has 0 type information. Decisions in HOptimizedGraphBuilder::HandleKeyedElementAccess are structured in way that leads us to generate generic keyed access which is not prefix by a soft HDeoptimize.

(this last problem can be perceived as a lack of proper type information propagation - something that TF potentially will address)

function sieve(maxNum) {
    var i;
    var j;

    var Data = new Uint8Array(maxNum + 1);
    for (i=2; i<=maxNum; i++) {
        Data[i] = 1;
    }

    for (i=2; i<=maxNum; i++) {
        if (Data[i]) {
            for (j=i+i; j<=maxNum; j+=i) {
                Data[j] = 0;  //
            }
        }
    }
}

function measure(f, m) {
    var start = Date.now();
    for (var j = 0; j < m; j++) {
        for (var i = 0; i < (1e3); i++) {
            f(1e5);
        }
    }
    var end = Date.now();
    return (end - start);
}

// var arr = new Uint8Array(100); // (*)

measure(sieve, 2);
print(measure(sieve, 5));

--
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/d/optout.

Reply via email to