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

Side by Side Diff: test/js-perf-test/AsyncAwait/baseline-babel-es2017.js

Issue 2577393002: [js-perf-test] Add a basic async-await microbenchmark (Closed)
Patch Set: Re-babel Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5
6 new BenchmarkSuite('BaselineES2017', [1000], [
7 new Benchmark('Basic', false, false, 0, Basic, Setup),
8 ]);
9
10 function _asyncToGenerator(fn) {
11 return function () {
12 var gen = fn.apply(this, arguments);
13 return new Promise(function (resolve, reject) {
14 function step(key, arg) {
15 try {
16 var info = gen[key](arg);
17 var value = info.value;
18 } catch (error) {
19 reject(error);
20 return;
21 }
22 if (info.done) {
23 resolve(value);
24 } else {
25 return Promise.resolve(value)
26 .then(function (value) {
27 step("next", value);
28 }, function (err) {
29 step("throw", err);
30 });
31 }
32 }
33 return step("next");
34 });
35 };
36 }
37
38 var a, b, c, d, e, f, g, h, i, j, x;
39
40 function Setup() {
41 x = Promise.resolve();
42
43 j = (() => {
44 var _ref = _asyncToGenerator(function* () {
45 return x;
46 });
47
48 function j() {
49 return _ref.apply(this, arguments);
50 }
51
52 return j;
53 })();
54 i = (() => {
55 var _ref2 = _asyncToGenerator(function* () {
56 yield j();
57 yield j();
58 yield j();
59 yield j();
60 yield j();
61 yield j();
62 yield j();
63 yield j();
64 yield j();
65 return j();
66 });
67
68 function i() {
69 return _ref2.apply(this, arguments);
70 }
71
72 return i;
73 })();
74 h = (() => {
75 var _ref3 = _asyncToGenerator(function* () {
76 return i();
77 });
78
79 function h() {
80 return _ref3.apply(this, arguments);
81 }
82
83 return h;
84 })();
85 g = (() => {
86 var _ref4 = _asyncToGenerator(function* () {
87 return h();
88 });
89
90 function g() {
91 return _ref4.apply(this, arguments);
92 }
93
94 return g;
95 })();
96 f = (() => {
97 var _ref5 = _asyncToGenerator(function* () {
98 return g();
99 });
100
101 function f() {
102 return _ref5.apply(this, arguments);
103 }
104
105 return f;
106 })();
107 e = (() => {
108 var _ref6 = _asyncToGenerator(function* () {
109 return f();
110 });
111
112 function e() {
113 return _ref6.apply(this, arguments);
114 }
115
116 return e;
117 })();
118 d = (() => {
119 var _ref7 = _asyncToGenerator(function* () {
120 return e();
121 });
122
123 function d() {
124 return _ref7.apply(this, arguments);
125 }
126
127 return d;
128 })();
129 c = (() => {
130 var _ref8 = _asyncToGenerator(function* () {
131 return d();
132 });
133
134 function c() {
135 return _ref8.apply(this, arguments);
136 }
137
138 return c;
139 })();
140 b = (() => {
141 var _ref9 = _asyncToGenerator(function* () {
142 return c();
143 });
144
145 function b() {
146 return _ref9.apply(this, arguments);
147 }
148
149 return b;
150 })();
151 a = (() => {
152 var _ref10 = _asyncToGenerator(function* () {
153 return b();
154 });
155
156 function a() {
157 return _ref10.apply(this, arguments);
158 }
159
160 return a;
161 })();
162
163 %RunMicrotasks();
164 }
165
166 function Basic() {
167 a();
168 %RunMicrotasks();
169 }
OLDNEW
« no previous file with comments | « no previous file | test/js-perf-test/AsyncAwait/baseline-naive-promises.js » ('j') | test/js-perf-test/JSTests.json » ('J')

Powered by Google App Engine
This is Rietveld 408576698