Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Issue 2143553002: [promises] Avoid creating resolving functions in Promise.resolve (Closed)

Created:
4 years, 5 months ago by gsathya
Modified:
4 years, 4 months ago
Reviewers:
Dan Ehrenberg, adamk
CC:
v8-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[promises] Avoid creating resolving functions in 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 Committed: https://crrev.com/140b8980915b966e88283c42f22d212a9fab1455 Cr-Commit-Position: refs/heads/master@{#38318}

Patch Set 1 #

Patch Set 2 : update comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -0 lines) Patch
M src/js/promise.js View 1 1 chunk +7 lines, -0 lines 0 comments Download

Messages

Total messages: 25 (18 generated)
gsathya
4 years, 4 months ago (2016-08-03 22:23:57 UTC) #12
Dan Ehrenberg
lgtm Looks like a good and correct optimization; I'm surprised that we didn't already do ...
4 years, 4 months ago (2016-08-03 22:29:31 UTC) #13
gsathya
On 2016/08/03 22:29:31, Dan Ehrenberg wrote: > lgtm > > Looks like a good and ...
4 years, 4 months ago (2016-08-03 22:40:40 UTC) #16
Dan Ehrenberg
lgtm
4 years, 4 months ago (2016-08-03 22:44:10 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2143553002/20001
4 years, 4 months ago (2016-08-03 22:55:39 UTC) #21
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years, 4 months ago (2016-08-03 22:57:44 UTC) #23
commit-bot: I haz the power
4 years, 4 months ago (2016-08-03 22:59:45 UTC) #25
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/140b8980915b966e88283c42f22d212a9fab1455
Cr-Commit-Position: refs/heads/master@{#38318}

Powered by Google App Engine
This is Rietveld 408576698