• gsathya's avatar
    [promises] Avoid creating resolving functions in · 140b8980
    gsathya authored
    Promise.resolve
    
    Instead of creating resolve and reject closures, directly
    call ResolvePromise after creating the promise.
    
    Using the following as a microbenchmark --
    ```
    var b = 0;
    var start = performance.now();
    for (var i = 0; i < 1000000; i++) {
      Promise.resolve(1).then((val) => {
        b += val;
        if (b == 1000000) print(performance.now() - start)
      });
    }
    ```
    
    I see a 16.01% improvement over 5 runs with this patch.
    
    BUG=v8:5046
    
    Review-Url: https://codereview.chromium.org/2143553002
    Cr-Commit-Position: refs/heads/master@{#38318}
    140b8980
Name
Last commit
Last update
..
OWNERS Loading commit data...
array-iterator.js Loading commit data...
array.js Loading commit data...
arraybuffer.js Loading commit data...
collection-iterator.js Loading commit data...
collection.js Loading commit data...
harmony-async-await.js Loading commit data...
harmony-atomics.js Loading commit data...
harmony-simd.js Loading commit data...
harmony-string-padding.js Loading commit data...
i18n.js Loading commit data...
icu-case-mapping.js Loading commit data...
intl-extra.js Loading commit data...
iterator-prototype.js Loading commit data...
macros.py Loading commit data...
math.js Loading commit data...
messages.js Loading commit data...
prologue.js Loading commit data...
promise-extra.js Loading commit data...
promise.js Loading commit data...
proxy.js Loading commit data...
regexp.js Loading commit data...
runtime.js Loading commit data...
spread.js Loading commit data...
string-iterator.js Loading commit data...
string.js Loading commit data...
symbol.js Loading commit data...
templates.js Loading commit data...
typedarray.js Loading commit data...
v8natives.js Loading commit data...
weak-collection.js Loading commit data...