Chromium Code Reviews| OLD | NEW |
|---|---|
| (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('BaselineNaivePromises', [1000], [ | |
| 7 new Benchmark('Basic', false, false, 0, Basic, Setup), | |
| 8 ]); | |
| 9 | |
| 10 var a,b,c,d,e,f,g,h,i,j,x; | |
| 11 | |
| 12 function Setup() { | |
| 13 x = Promise.resolve(); | |
| 14 | |
| 15 j = function j(p) { return p; }; | |
| 16 i = function i(p) { | |
| 17 var promises = []; | |
| 18 for (let i = 0; i < 10; i++) promises.push(j()); | |
| 19 return Promise.all(promises); | |
|
gsathya
2016/12/16 15:23:05
promises is an array of undefineds, not an array o
jgruber
2016/12/19 08:31:01
Good catch, done.
| |
| 20 }; | |
| 21 h = function h(p) { return p; }; | |
| 22 g = function g(p) { return p; }; | |
| 23 f = function f(p) { return p; }; | |
| 24 e = function e(p) { return p; }; | |
| 25 d = function d(p) { return p; }; | |
| 26 c = function c(p) { return p; }; | |
| 27 b = function b(p) { return p; }; | |
| 28 a = function a(p) { return p; }; | |
| 29 | |
| 30 %RunMicrotasks(); | |
| 31 } | |
| 32 | |
| 33 function Basic() { | |
| 34 x.then(j) | |
| 35 .then(i) | |
| 36 .then(h) | |
| 37 .then(g) | |
| 38 .then(f) | |
| 39 .then(e) | |
| 40 .then(d) | |
| 41 .then(c) | |
| 42 .then(b) | |
| 43 .then(a); | |
| 44 %RunMicrotasks(); | |
| 45 } | |
| OLD | NEW |