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 return p.then(j) |
| 18 .then(j) |
| 19 .then(j) |
| 20 .then(j) |
| 21 .then(j) |
| 22 .then(j) |
| 23 .then(j) |
| 24 .then(j) |
| 25 .then(j) |
| 26 .then(j); |
| 27 }; |
| 28 h = function h(p) { return p; }; |
| 29 g = function g(p) { return p; }; |
| 30 f = function f(p) { return p; }; |
| 31 e = function e(p) { return p; }; |
| 32 d = function d(p) { return p; }; |
| 33 c = function c(p) { return p; }; |
| 34 b = function b(p) { return p; }; |
| 35 a = function a(p) { return p; }; |
| 36 |
| 37 %RunMicrotasks(); |
| 38 } |
| 39 |
| 40 function Basic() { |
| 41 x.then(j) |
| 42 .then(i) |
| 43 .then(h) |
| 44 .then(g) |
| 45 .then(f) |
| 46 .then(e) |
| 47 .then(d) |
| 48 .then(c) |
| 49 .then(b) |
| 50 .then(a); |
| 51 %RunMicrotasks(); |
| 52 } |
OLD | NEW |