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

Side by Side Diff: test/js-perf-test/Closures/closures.js

Issue 2526163003: Revert of [test] Add performance test for closures. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | test/js-perf-test/Closures/run.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 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 new BenchmarkSuite('Closures', [1000], [
6 new Benchmark('ShortLivingClosures', false, false, 0,
7 ShortLivingClosures, ShortLivingClosuresSetup, ShortLivingClosuresTearDown)
8 ]);
9
10 // ----------------------------------------------------------------------------
11
12
13 // The pattern is this example is very common in Node.js.
14 var fs = {
15 readFile: function(filename, cb) {
16 cb(null, {length: 12});
17 }
18 };
19
20
21 function printLength (filename) {
22 fs.readFile(filename, foo);
23
24 function foo (err, buf) {
25 if (err) return;
26 for (var j = 0; j<1000; j++) {
27 // Do some work to make the optimization actually worth while
28 buf.length++;
29 }
30 return (buf.length);
31 }
32 }
33
34
35 function ShortLivingClosuresSetup() {}
36
37 function ShortLivingClosures() {
38 result = printLength('foo_bar.js');
39 }
40
41 function ShortLivingClosuresTearDown() {
42 return result == 1012;
43 }
OLDNEW
« no previous file with comments | « no previous file | test/js-perf-test/Closures/run.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698