Last active
August 29, 2015 14:11
-
-
Save bajtos/f8fca4fad36ada8e21dc to your computer and use it in GitHub Desktop.
Benchmark of fs.stat with promises
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Call fs.stat over and over again really fast. | |
// Then see how many times it got called. | |
// Yes, this is a silly benchmark. Most benchmarks are silly. | |
var path = require('path'); | |
var common = require('../common.js'); | |
var fs = require('fs'); | |
var FILES = [ | |
require.resolve('../../lib/assert.js'), | |
require.resolve('../../lib/console.js'), | |
require.resolve('../../lib/fs.js') | |
]; | |
var VARIANTS = { | |
promisedAndPromise: createPromiseBasedTest(statViaPromise), | |
promisedAndCallback: createCallBackBasedTest(statViaPromise), | |
callbackAndPromise: createPromiseBasedTest(statViaCallback), | |
callbackAndCallback: createCallBackBasedTest(statViaCallback), | |
nativeAndCallback: createCallBackBasedTest(fs.stat) | |
}; | |
var bench = common.createBenchmark(main, { | |
dur: [5], | |
concurrent: [1, 10, 100], | |
promise: ['native', 'bluebird'], | |
variant: Object.keys(VARIANTS) | |
}); | |
function main(conf) { | |
var stat = VARIANTS[conf.variant]; | |
if (conf.promise === 'bluebird') Promise = require('bluebird'); | |
var calls = 0; | |
bench.start(); | |
setTimeout(function() { | |
bench.end(calls); | |
}, +conf.dur * 1000); | |
var cur = +conf.concurrent; | |
while (cur--) run(); | |
function run() { | |
var p = stat(next); | |
if (p) p.then(next); | |
} | |
function next() { | |
calls++; | |
run(); | |
} | |
} | |
function createCallBackBasedTest(stat) { | |
return function runStatViaCallbacks(cb) { | |
stat(FILES[0], function(err, data) { | |
if (err) throw err; | |
second(); | |
}); | |
function second() { | |
stat(FILES[1], function(err, data) { | |
if (err) throw err; | |
third(); | |
}); | |
} | |
function third() { | |
stat(FILES[2], function(err, data) { | |
if (err) throw err; | |
cb(); | |
}); | |
} | |
}; | |
} | |
function createPromiseBasedTest(stat) { | |
return function runStatViaPromises() { | |
return stat(FILES[0]) | |
.then(function secondP(data) { | |
return stat(FILES[1]); | |
}) | |
.then(function thirdP(data) { | |
return stat(FILES[2]); | |
}); | |
} | |
} | |
/*---- CODE PASTED FROM lib/fs.js ----*/ | |
var util = require('util'); | |
var pathModule = require('path'); | |
var binding = process.binding('fs'); | |
var FSReqWrap = binding.FSReqWrap; | |
function statViaCallback(path, callback) { | |
if (!callback) { | |
return new Promise(function(resolve, reject) { | |
statViaCallback(path, function(err, data) { | |
if (err) reject(err); | |
else resolve(data); | |
}); | |
}); | |
} | |
callback = makeCallback(callback); | |
if (!nullCheck(path, callback)) return; | |
var req = new FSReqWrap(); | |
req.oncomplete = callback; | |
binding.stat(pathModule._makeLong(path), req); | |
}; | |
// Ensure that callbacks run in the global context. Only use this function | |
// for callbacks that are passed to the binding layer, callbacks that are | |
// invoked from JS already run in the proper scope. | |
function makeCallback(cb) { | |
if (!util.isFunction(cb)) { | |
return rethrow(); | |
} | |
return function() { | |
return cb.apply(null, arguments); | |
}; | |
} | |
function nullCheck(path, callback) { | |
if (('' + path).indexOf('\u0000') !== -1) { | |
var er = new Error('Path must be a string without null bytes.'); | |
if (!callback) | |
throw er; | |
process.nextTick(function() { | |
callback(er); | |
}); | |
return false; | |
} | |
return true; | |
} | |
/*---- PROMISIFIED IMPLEMENTATION BASED ON lib/fs.js ----*/ | |
function statViaPromise(path, callback) { | |
if (callback) callback = makeCallback(callback); | |
var promise = new Promise(function StatPromise(resolve, reject) { | |
if (rejectIfNull(path, reject)) return; | |
var req = new FSReqWrap(); | |
req.oncomplete = function resolveStatCompletion(err, result) { | |
resolve(result); | |
}; | |
binding.stat(pathModule._makeLong(path), req); | |
}); | |
if (!callback) return promise; | |
promise | |
.then(function(result) { callback(null, result); }) | |
.catch(function(err) { callback(err); }); | |
// return undefined | |
} | |
function rejectIfNull(path, reject) { | |
if (('' + path).indexOf('\u0000') !== -1) { | |
var er = new Error('Path must be a string without null bytes.'); | |
reject(err); | |
return true; | |
} | |
return false; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Machine: rMBP; 2.7 GHz Intel Core i7; 16 GB 1600 MHz DDR3 | |
io.js version: v0.11.15-pre (99e7c58) | |
V8 version: 3.30.37 | |
fs/promised-stat.js dur=5 concurrent=10 promise=native variant=promisedAndPromise: 15969 | |
fs/promised-stat.js dur=5 concurrent=10 promise=native variant=promisedAndCallback: 13414 | |
fs/promised-stat.js dur=5 concurrent=10 promise=native variant=callbackAndPromise: 17753 | |
fs/promised-stat.js dur=5 concurrent=10 promise=native variant=callbackAndCallback: 38572 | |
fs/promised-stat.js dur=5 concurrent=10 promise=native variant=nativeAndCallback: 39432 | |
Using Bluebird instead of native promises: | |
fs/promised-stat.js dur=5 concurrent=10 promise=bluebird variant=promisedAndPromise: 24612 | |
fs/promised-stat.js dur=5 concurrent=10 promise=bluebird variant=promisedAndCallback: 22240 | |
fs/promised-stat.js dur=5 concurrent=10 promise=bluebird variant=callbackAndPromise: 29612 | |
fs/promised-stat.js dur=5 concurrent=10 promise=bluebird variant=callbackAndCallback: 40402 | |
fs/promised-stat.js dur=5 concurrent=10 promise=bluebird variant=nativeAndCallback: 39807 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Statistical profiling result from isolate-0x102000000-v8.log, (17944 ticks, 143 unaccounted, 0 excluded). | |
[Unknown]: | |
ticks total nonlib name | |
143 0.8% | |
[Shared libraries]: | |
ticks total nonlib name | |
12635 70.4% 0.0% /Users/bajtos/src/io.js/out/Release/node | |
528 2.9% 0.0% /usr/lib/system/libsystem_malloc.dylib | |
474 2.6% 0.0% /usr/lib/system/libsystem_platform.dylib | |
292 1.6% 0.0% /usr/lib/system/libsystem_kernel.dylib | |
56 0.3% 0.0% /usr/lib/system/libsystem_m.dylib | |
40 0.2% 0.0% /usr/lib/system/libsystem_pthread.dylib | |
21 0.1% 0.0% /usr/lib/libc++abi.dylib | |
9 0.1% 0.0% /usr/lib/system/libsystem_c.dylib | |
1 0.0% 0.0% /usr/lib/libstdc++.6.dylib | |
[JavaScript]: | |
ticks total nonlib name | |
268 1.5% 6.9% Builtin: A builtin from the snapshot | |
240 1.3% 6.2% LazyCompile: PromiseHandle native promise.js:76:23 | |
217 1.2% 5.6% Stub: CEntryStub | |
142 0.8% 3.7% Stub: CallConstructStub | |
136 0.8% 3.5% LazyCompile: ~StatPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:145:49 | |
132 0.7% 3.4% LazyCompile: *fs.Stats fs.js:120:20 | |
131 0.7% 3.4% LazyCompile: Promise native promise.js:20:23 | |
130 0.7% 3.3% LazyCompile: ~<anonymous> native promise.js:209:9 | |
106 0.6% 2.7% KeyedLoadIC: A keyed load IC from the snapshot | |
104 0.6% 2.7% Builtin: A builtin from the snapshot {1} | |
102 0.6% 2.6% LazyCompile: *Date native date.js:62:25 | |
92 0.5% 2.4% LazyCompile: ~<anonymous> native promise.js:94:27 | |
86 0.5% 2.2% LazyCompile: PromiseCoerce native promise.js:56:23 | |
83 0.5% 2.1% LazyCompile: ~chain native promise.js:166:35 | |
73 0.4% 1.9% Stub: FastNewClosureStub {1} | |
71 0.4% 1.8% LazyCompile: *statViaPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:142:24 | |
66 0.4% 1.7% LazyCompile: *PromiseSet native promise.js:36:20 | |
62 0.3% 1.6% Stub: CompareICStub {1} | |
59 0.3% 1.5% Stub: CallConstructStub {1} | |
54 0.3% 1.4% Stub: FastNewContextStub | |
54 0.3% 1.4% Stub: FastNewClosureStub | |
54 0.3% 1.4% Builtin: A builtin from the snapshot {4} | |
53 0.3% 1.4% LazyCompile: *next /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:48:16 | |
52 0.3% 1.3% Stub: CompareICStub | |
51 0.3% 1.3% Stub: JSEntryStub {1} | |
50 0.3% 1.3% LazyCompile: ConfigureTemplateInstance native apinatives.js:63:35 | |
49 0.3% 1.3% Stub: JSEntryStub | |
43 0.2% 1.1% Builtin: A builtin from the snapshot {2} | |
42 0.2% 1.1% LazyCompile: *rejectIfNull /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:162:22 | |
42 0.2% 1.1% KeyedLoadIC: {97} | |
41 0.2% 1.1% Stub: StoreTransitionStub | |
41 0.2% 1.1% LazyCompile: ~resolveStatCompletion /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:148:52 | |
40 0.2% 1.0% LazyCompile: *IsPromise native promise.js:114:29 | |
35 0.2% 0.9% LazyCompile: ~<anonymous> native promise.js:28:11 | |
34 0.2% 0.9% Stub: InternalArrayNoArgumentConstructorStub | |
31 0.2% 0.8% Stub: promiseRaw | |
31 0.2% 0.8% KeyedStoreIC: A keyed store IC from the snapshot | |
31 0.2% 0.8% Builtin: A builtin from the snapshot {3} | |
29 0.2% 0.7% Stub: symbol(hash 1fa6f443) | |
28 0.2% 0.7% Stub: push | |
27 0.2% 0.7% LazyCompile: ~resolve native promise.js:137:17 | |
27 0.2% 0.7% LazyCompile: *PromiseDone native promise.js:50:21 | |
27 0.2% 0.7% Handler: An IC handler from the snapshot {2} | |
26 0.1% 0.7% LazyCompile: *defer native promise.js:132:25 | |
25 0.1% 0.6% Stub: ToBooleanStub(Undefined,SpecObject) | |
25 0.1% 0.6% Stub: LoadConstantStub {1} | |
25 0.1% 0.6% Stub: FastNewContextStub {1} | |
25 0.1% 0.6% Stub: CallICStub(args(2), METHOD, | |
25 0.1% 0.6% LazyCompile: *PromiseInit native promise.js:46:21 | |
23 0.1% 0.6% LazyCompile: ~thirdP /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:83:28 | |
22 0.1% 0.6% LazyCompile: *posix._makeLong path.js:530:27 | |
21 0.1% 0.5% Stub: ToBooleanStub | |
20 0.1% 0.5% Stub: oncomplete {1} | |
20 0.1% 0.5% LazyCompile: *then native promise.js:200:33 | |
19 0.1% 0.5% Stub: LoadConstantStub | |
17 0.1% 0.4% LazyCompile: *PromiseEnqueue native promise.js:92:24 | |
16 0.1% 0.4% Stub: constructor {NaN} | |
15 0.1% 0.4% Stub: InternalArrayConstructorStub | |
14 0.1% 0.4% Stub: IsPromise {1} | |
14 0.1% 0.4% Stub: CompareICStub {3} | |
13 0.1% 0.3% Stub: LoadFastElementStub | |
13 0.1% 0.3% Stub: CompareICStub {7} | |
13 0.1% 0.3% Stub: CompareICStub {6} | |
13 0.1% 0.3% LazyCompile: *indexOf native string.js:54:25 | |
13 0.1% 0.3% LazyCompile: *PromiseResolve native promise.js:120:39 | |
13 0.1% 0.3% Handler: An IC handler from the snapshot {1} | |
12 0.1% 0.3% KeyedLoadIC: {99} | |
12 0.1% 0.3% Handler: An IC handler from the snapshot {3} | |
11 0.1% 0.3% Handler: An IC handler from the snapshot | |
10 0.1% 0.3% Stub: LoadFastElementStub {1} | |
10 0.1% 0.3% LazyCompile: ~secondP /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:80:29 | |
9 0.1% 0.2% Stub: FastNewContextStub {3} | |
9 0.1% 0.2% Stub: CompareICStub {8} | |
8 0.0% 0.2% Stub: LoadConstantStub {2} | |
7 0.0% 0.2% Stub: PromiseChain | |
7 0.0% 0.2% Stub: CompareICStub {5} | |
7 0.0% 0.2% KeyedLoadIC: symbol("Promise#status" hash 16f76b3f) | |
6 0.0% 0.2% Stub: promiseOnResolve | |
6 0.0% 0.2% Stub: promiseHasHandler | |
6 0.0% 0.2% Stub: FastNewContextStub {2} | |
6 0.0% 0.2% Stub: CompareICStub {4} | |
4 0.0% 0.1% Stub: PromiseResolve | |
3 0.0% 0.1% Stub: promiseStatus | |
3 0.0% 0.1% Stub: RecordWriteStub {3} | |
3 0.0% 0.1% LazyCompile: ~indexOf native string.js:54:25 | |
3 0.0% 0.1% KeyedLoadIC: symbol("Promise#onReject" hash 392de1fd) | |
3 0.0% 0.1% Builtin: A builtin from the snapshot {7} | |
3 0.0% 0.1% Builtin: A builtin from the snapshot {5} | |
2 0.0% 0.1% Stub: promiseOnReject | |
2 0.0% 0.1% Stub: RecordWriteStub {1} | |
2 0.0% 0.1% KeyedLoadIC: symbol("Promise#onResolve" hash e03bee5) | |
2 0.0% 0.1% Handler: An IC handler from the snapshot {5} | |
2 0.0% 0.1% Builtin: A builtin from the snapshot {8} | |
1 0.0% 0.0% Stub: compile | |
1 0.0% 0.0% Stub: RecordWriteStub {4} | |
1 0.0% 0.0% Stub: RecordWriteStub {2} | |
1 0.0% 0.0% Stub: RecordWriteStub | |
1 0.0% 0.0% Stub: CompareICStub {2} | |
1 0.0% 0.0% LazyCompile: ~PromiseDone native promise.js:50:21 | |
1 0.0% 0.0% LazyCompile: ~Date native date.js:62:25 | |
[C++]: | |
ticks total nonlib name | |
[GC]: | |
ticks total nonlib name | |
1457 8.1% | |
[Bottom up (heavy) profile]: | |
Note: percentage shows a share of a particular caller in the total | |
amount of its parent calls. | |
Callers occupying less than 2.0% are not shown. | |
ticks parent name | |
12635 70.4% /Users/bajtos/src/io.js/out/Release/node | |
8984 71.1% /Users/bajtos/src/io.js/out/Release/node | |
3162 35.2% LazyCompile: *PromiseSet native promise.js:36:20 | |
2145 67.8% LazyCompile: *PromiseInit native promise.js:46:21 | |
1268 59.1% LazyCompile: Promise native promise.js:20:23 | |
1268 100.0% LazyCompile: *statViaPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:142:24 | |
877 40.9% LazyCompile: *defer native promise.js:132:25 | |
877 100.0% LazyCompile: ~chain native promise.js:166:35 | |
1013 32.0% LazyCompile: *PromiseDone native promise.js:50:21 | |
1013 100.0% LazyCompile: *PromiseResolve native promise.js:120:39 | |
541 53.4% LazyCompile: ~resolve native promise.js:137:17 | |
472 46.6% LazyCompile: ~<anonymous> native promise.js:28:11 | |
3055 34.0% LazyCompile: ~StatPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:145:49 | |
3055 100.0% LazyCompile: Promise native promise.js:20:23 | |
3054 100.0% LazyCompile: *statViaPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:142:24 | |
1486 48.7% LazyCompile: ~secondP /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:80:29 | |
786 25.7% LazyCompile: *next /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:48:16 | |
782 25.6% LazyCompile: ~thirdP /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:83:28 | |
631 7.0% LazyCompile: *IsPromise native promise.js:114:29 | |
462 73.2% LazyCompile: PromiseCoerce native promise.js:56:23 | |
462 100.0% LazyCompile: ~<anonymous> native promise.js:209:9 | |
462 100.0% LazyCompile: PromiseHandle native promise.js:76:23 | |
168 26.6% LazyCompile: ~<anonymous> native promise.js:209:9 | |
168 100.0% LazyCompile: PromiseHandle native promise.js:76:23 | |
168 100.0% LazyCompile: ~<anonymous> native promise.js:94:27 | |
522 5.8% LazyCompile: ~chain native promise.js:166:35 | |
310 59.4% LazyCompile: *then native promise.js:200:33 | |
310 100.0% LazyCompile: *next /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:48:16 | |
310 100.0% LazyCompile: ~<anonymous> native promise.js:209:9 | |
212 40.6% LazyCompile: PromiseHandle native promise.js:76:23 | |
212 100.0% LazyCompile: ~<anonymous> native promise.js:94:27 | |
472 5.3% LazyCompile: *PromiseEnqueue native promise.js:92:24 | |
468 99.2% LazyCompile: *PromiseDone native promise.js:50:21 | |
468 100.0% LazyCompile: *PromiseResolve native promise.js:120:39 | |
246 52.6% LazyCompile: ~resolve native promise.js:137:17 | |
222 47.4% LazyCompile: ~<anonymous> native promise.js:28:11 | |
341 3.8% LazyCompile: *Date native date.js:62:25 | |
341 100.0% LazyCompile: *fs.Stats fs.js:120:20 | |
269 3.0% LazyCompile: *indexOf native string.js:54:25 | |
269 100.0% LazyCompile: *rejectIfNull /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:162:22 | |
269 100.0% LazyCompile: ~StatPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:145:49 | |
269 100.0% LazyCompile: Promise native promise.js:20:23 | |
203 2.3% LazyCompile: PromiseHandle native promise.js:76:23 | |
203 100.0% LazyCompile: ~<anonymous> native promise.js:94:27 | |
528 2.9% /usr/lib/system/libsystem_malloc.dylib | |
463 87.7% /Users/bajtos/src/io.js/out/Release/node | |
306 66.1% LazyCompile: PromiseHandle native promise.js:76:23 | |
306 100.0% LazyCompile: ~<anonymous> native promise.js:94:27 | |
144 31.1% LazyCompile: Promise native promise.js:20:23 | |
143 99.3% LazyCompile: *statViaPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:142:24 | |
50 35.0% LazyCompile: *next /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:48:16 | |
50 100.0% LazyCompile: ~<anonymous> native promise.js:209:9 | |
47 32.9% LazyCompile: ~thirdP /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:83:28 | |
47 100.0% LazyCompile: ~<anonymous> native promise.js:209:9 | |
46 32.2% LazyCompile: ~secondP /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:80:29 | |
46 100.0% LazyCompile: ~<anonymous> native promise.js:209:9 | |
474 2.6% /usr/lib/system/libsystem_platform.dylib | |
349 73.6% /Users/bajtos/src/io.js/out/Release/node | |
126 36.1% LazyCompile: *PromiseSet native promise.js:36:20 | |
110 87.3% LazyCompile: *PromiseInit native promise.js:46:21 | |
66 60.0% LazyCompile: Promise native promise.js:20:23 | |
66 100.0% LazyCompile: *statViaPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:142:24 | |
44 40.0% LazyCompile: *defer native promise.js:132:25 | |
44 100.0% LazyCompile: ~chain native promise.js:166:35 | |
16 12.7% LazyCompile: *PromiseDone native promise.js:50:21 | |
16 100.0% LazyCompile: *PromiseResolve native promise.js:120:39 | |
13 81.3% LazyCompile: ~<anonymous> native promise.js:28:11 | |
3 18.8% LazyCompile: ~resolve native promise.js:137:17 | |
80 22.9% LazyCompile: PromiseHandle native promise.js:76:23 | |
80 100.0% LazyCompile: ~<anonymous> native promise.js:94:27 | |
43 12.3% LazyCompile: ~chain native promise.js:166:35 | |
24 55.8% LazyCompile: PromiseHandle native promise.js:76:23 | |
24 100.0% LazyCompile: ~<anonymous> native promise.js:94:27 | |
19 44.2% LazyCompile: *then native promise.js:200:33 | |
19 100.0% LazyCompile: *next /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:48:16 | |
19 100.0% LazyCompile: ~<anonymous> native promise.js:209:9 | |
33 9.5% LazyCompile: ~StatPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:145:49 | |
33 100.0% LazyCompile: Promise native promise.js:20:23 | |
33 100.0% LazyCompile: *statViaPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:142:24 | |
15 45.5% LazyCompile: ~secondP /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:80:29 | |
9 27.3% LazyCompile: ~thirdP /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:83:28 | |
9 27.3% LazyCompile: *next /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:48:16 | |
21 6.0% LazyCompile: *PromiseEnqueue native promise.js:92:24 | |
20 95.2% LazyCompile: *PromiseDone native promise.js:50:21 | |
20 100.0% LazyCompile: *PromiseResolve native promise.js:120:39 | |
16 80.0% LazyCompile: ~<anonymous> native promise.js:28:11 | |
4 20.0% LazyCompile: ~resolve native promise.js:137:17 | |
1 4.8% LazyCompile: ~PromiseDone native promise.js:50:21 | |
1 100.0% LazyCompile: *PromiseResolve native promise.js:120:39 | |
1 100.0% LazyCompile: ~<anonymous> native promise.js:28:11 | |
20 5.7% LazyCompile: Promise native promise.js:20:23 | |
20 100.0% LazyCompile: *statViaPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:142:24 | |
9 45.0% LazyCompile: ~thirdP /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:83:28 | |
9 100.0% LazyCompile: ~<anonymous> native promise.js:209:9 | |
6 30.0% LazyCompile: *next /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:48:16 | |
6 100.0% LazyCompile: ~<anonymous> native promise.js:209:9 | |
5 25.0% LazyCompile: ~secondP /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:80:29 | |
5 100.0% LazyCompile: ~<anonymous> native promise.js:209:9 | |
12 3.4% LazyCompile: *Date native date.js:62:25 | |
12 100.0% LazyCompile: *fs.Stats fs.js:120:20 | |
[Top down (heavy) profile]: | |
Note: callees occupying less than 0.1% are not shown. | |
inclusive self name | |
ticks total ticks total | |
11712 65.3% 92 0.5% LazyCompile: ~<anonymous> native promise.js:94:27 | |
11553 64.4% 227 1.3% LazyCompile: PromiseHandle native promise.js:76:23 | |
8664 48.3% 128 0.7% LazyCompile: ~<anonymous> native promise.js:209:9 | |
2980 16.6% 53 0.3% LazyCompile: *next /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:48:16 | |
1725 9.6% 26 0.1% LazyCompile: *statViaPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:142:24 | |
1639 9.1% 49 0.3% LazyCompile: Promise native promise.js:20:23 | |
979 5.5% 26 0.1% LazyCompile: ~StatPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:145:49 | |
797 4.4% 0 0.0% /Users/bajtos/src/io.js/out/Release/node | |
786 4.4% 786 4.4% /Users/bajtos/src/io.js/out/Release/node | |
74 0.4% 9 0.1% LazyCompile: *rejectIfNull /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:162:22 | |
62 0.3% 3 0.0% LazyCompile: *indexOf native string.js:54:25 | |
57 0.3% 0 0.0% /Users/bajtos/src/io.js/out/Release/node | |
57 0.3% 57 0.3% /Users/bajtos/src/io.js/out/Release/node | |
30 0.2% 14 0.1% LazyCompile: ConfigureTemplateInstance native apinatives.js:63:35 | |
475 2.6% 5 0.0% LazyCompile: *PromiseInit native promise.js:46:21 | |
448 2.5% 5 0.0% LazyCompile: *PromiseSet native promise.js:36:20 | |
438 2.4% 2 0.0% /Users/bajtos/src/io.js/out/Release/node | |
420 2.3% 420 2.3% /Users/bajtos/src/io.js/out/Release/node | |
86 0.5% 2 0.0% /Users/bajtos/src/io.js/out/Release/node | |
50 0.3% 50 0.3% /usr/lib/system/libsystem_malloc.dylib | |
23 0.1% 23 0.1% /Users/bajtos/src/io.js/out/Release/node | |
20 0.1% 20 0.1% Builtin: A builtin from the snapshot | |
1174 6.5% 20 0.1% LazyCompile: *then native promise.js:200:33 | |
1053 5.9% 43 0.2% LazyCompile: ~chain native promise.js:166:35 | |
579 3.2% 11 0.1% LazyCompile: *defer native promise.js:132:25 | |
512 2.9% 4 0.0% LazyCompile: *PromiseInit native promise.js:46:21 | |
489 2.7% 3 0.0% LazyCompile: *PromiseSet native promise.js:36:20 | |
478 2.7% 5 0.0% /Users/bajtos/src/io.js/out/Release/node | |
457 2.5% 457 2.5% /Users/bajtos/src/io.js/out/Release/node | |
19 0.1% 3 0.0% LazyCompile: Promise native promise.js:20:23 | |
357 2.0% 12 0.1% /Users/bajtos/src/io.js/out/Release/node | |
310 1.7% 310 1.7% /Users/bajtos/src/io.js/out/Release/node | |
19 0.1% 19 0.1% /usr/lib/system/libsystem_platform.dylib | |
85 0.5% 2 0.0% /Users/bajtos/src/io.js/out/Release/node | |
83 0.5% 83 0.5% /Users/bajtos/src/io.js/out/Release/node | |
2473 13.8% 10 0.1% LazyCompile: ~secondP /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:80:29 | |
2450 13.7% 10 0.1% LazyCompile: *statViaPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:142:24 | |
2412 13.4% 16 0.1% LazyCompile: Promise native promise.js:20:23 | |
1973 11.0% 74 0.4% LazyCompile: ~StatPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:145:49 | |
1511 8.4% 5 0.0% /Users/bajtos/src/io.js/out/Release/node | |
1486 8.3% 1486 8.3% /Users/bajtos/src/io.js/out/Release/node | |
181 1.0% 21 0.1% LazyCompile: *rejectIfNull /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:162:22 | |
158 0.9% 4 0.0% LazyCompile: *indexOf native string.js:54:25 | |
146 0.8% 0 0.0% /Users/bajtos/src/io.js/out/Release/node | |
146 0.8% 146 0.8% /Users/bajtos/src/io.js/out/Release/node | |
70 0.4% 28 0.2% LazyCompile: ConfigureTemplateInstance native apinatives.js:63:35 | |
24 0.1% 0 0.0% /Users/bajtos/src/io.js/out/Release/node | |
24 0.1% 24 0.1% /Users/bajtos/src/io.js/out/Release/node | |
31 0.2% 31 0.2% Stub: CallConstructStub {1} | |
18 0.1% 18 0.1% Builtin: A builtin from the snapshot {3} | |
283 1.6% 5 0.0% LazyCompile: *PromiseInit native promise.js:46:21 | |
265 1.5% 0 0.0% LazyCompile: *PromiseSet native promise.js:36:20 | |
264 1.5% 2 0.0% /Users/bajtos/src/io.js/out/Release/node | |
243 1.4% 243 1.4% /Users/bajtos/src/io.js/out/Release/node | |
19 0.1% 19 0.1% /usr/lib/system/libsystem_platform.dylib | |
81 0.5% 0 0.0% /Users/bajtos/src/io.js/out/Release/node | |
46 0.3% 46 0.3% /usr/lib/system/libsystem_malloc.dylib | |
26 0.1% 26 0.1% /Users/bajtos/src/io.js/out/Release/node | |
22 0.1% 22 0.1% Stub: FastNewClosureStub | |
2110 11.8% 23 0.1% LazyCompile: ~thirdP /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:83:28 | |
2034 11.3% 35 0.2% LazyCompile: *statViaPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:142:24 | |
1915 10.7% 58 0.3% LazyCompile: Promise native promise.js:20:23 | |
1009 5.6% 36 0.2% LazyCompile: ~StatPromise /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:145:49 | |
792 4.4% 0 0.0% /Users/bajtos/src/io.js/out/Release/node | |
782 4.4% 782 4.4% /Users/bajtos/src/io.js/out/Release/node | |
92 0.5% 12 0.1% LazyCompile: *rejectIfNull /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:162:22 | |
77 0.4% 6 0.0% LazyCompile: *indexOf native string.js:54:25 | |
66 0.4% 0 0.0% /Users/bajtos/src/io.js/out/Release/node | |
66 0.4% 66 0.4% /Users/bajtos/src/io.js/out/Release/node | |
693 3.9% 11 0.1% LazyCompile: *PromiseInit native promise.js:46:21 | |
660 3.7% 9 0.1% LazyCompile: *PromiseSet native promise.js:36:20 | |
641 3.6% 5 0.0% /Users/bajtos/src/io.js/out/Release/node | |
605 3.4% 605 3.4% /Users/bajtos/src/io.js/out/Release/node | |
31 0.2% 31 0.2% /usr/lib/system/libsystem_platform.dylib | |
94 0.5% 0 0.0% /Users/bajtos/src/io.js/out/Release/node | |
47 0.3% 47 0.3% /usr/lib/system/libsystem_malloc.dylib | |
34 0.2% 34 0.2% /Users/bajtos/src/io.js/out/Release/node | |
22 0.1% 22 0.1% Stub: FastNewContextStub | |
34 0.2% 34 0.2% Stub: FastNewClosureStub {1} | |
21 0.1% 21 0.1% Stub: CallConstructStub | |
18 0.1% 18 0.1% Builtin: A builtin from the snapshot | |
37 0.2% 37 0.2% KeyedLoadIC: {97} | |
712 4.0% 84 0.5% LazyCompile: PromiseCoerce native promise.js:56:23 | |
525 2.9% 15 0.1% LazyCompile: *IsPromise native promise.js:114:29 | |
476 2.7% 11 0.1% /Users/bajtos/src/io.js/out/Release/node | |
462 2.6% 462 2.6% /Users/bajtos/src/io.js/out/Release/node | |
23 0.1% 23 0.1% KeyedLoadIC: A keyed load IC from the snapshot | |
62 0.3% 62 0.3% Stub: CompareICStub {1} | |
29 0.2% 29 0.2% Stub: symbol(hash 1fa6f443) | |
191 1.1% 9 0.1% LazyCompile: *IsPromise native promise.js:114:29 | |
170 0.9% 1 0.0% /Users/bajtos/src/io.js/out/Release/node | |
168 0.9% 168 0.9% /Users/bajtos/src/io.js/out/Release/node | |
52 0.3% 52 0.3% Stub: CompareICStub | |
998 5.6% 25 0.1% LazyCompile: ~resolve native promise.js:137:17 | |
946 5.3% 3 0.0% LazyCompile: *PromiseResolve native promise.js:120:39 | |
932 5.2% 13 0.1% LazyCompile: *PromiseDone native promise.js:50:21 | |
587 3.3% 20 0.1% LazyCompile: *PromiseSet native promise.js:36:20 | |
551 3.1% 7 0.0% /Users/bajtos/src/io.js/out/Release/node | |
541 3.0% 541 3.0% /Users/bajtos/src/io.js/out/Release/node | |
278 1.5% 9 0.1% LazyCompile: *PromiseEnqueue native promise.js:92:24 | |
253 1.4% 3 0.0% /Users/bajtos/src/io.js/out/Release/node | |
246 1.4% 246 1.4% /Users/bajtos/src/io.js/out/Release/node | |
32 0.2% 32 0.2% KeyedLoadIC: A keyed load IC from the snapshot | |
24 0.1% 0 0.0% /Users/bajtos/src/io.js/out/Release/node | |
948 5.3% 37 0.2% LazyCompile: ~chain native promise.js:166:35 | |
547 3.0% 3 0.0% LazyCompile: *defer native promise.js:132:25 | |
508 2.8% 0 0.0% LazyCompile: *PromiseInit native promise.js:46:21 | |
490 2.7% 4 0.0% LazyCompile: *PromiseSet native promise.js:36:20 | |
482 2.7% 5 0.0% /Users/bajtos/src/io.js/out/Release/node | |
420 2.3% 420 2.3% /Users/bajtos/src/io.js/out/Release/node | |
29 0.2% 0 0.0% LazyCompile: ConfigureTemplateInstance native apinatives.js:63:35 | |
29 0.2% 29 0.2% /Users/bajtos/src/io.js/out/Release/node | |
28 0.2% 28 0.2% /usr/lib/system/libsystem_platform.dylib | |
274 1.5% 16 0.1% /Users/bajtos/src/io.js/out/Release/node | |
212 1.2% 212 1.2% /Users/bajtos/src/io.js/out/Release/node | |
24 0.1% 24 0.1% /usr/lib/system/libsystem_platform.dylib | |
20 0.1% 0 0.0% LazyCompile: *PromiseInit native promise.js:46:21 | |
20 0.1% 20 0.1% /Users/bajtos/src/io.js/out/Release/node | |
605 3.4% 8 0.0% /Users/bajtos/src/io.js/out/Release/node | |
306 1.7% 306 1.7% /usr/lib/system/libsystem_malloc.dylib | |
203 1.1% 203 1.1% /Users/bajtos/src/io.js/out/Release/node | |
80 0.4% 80 0.4% /usr/lib/system/libsystem_platform.dylib | |
20 0.1% 20 0.1% Stub: CEntryStub | |
20 0.1% 10 0.1% LazyCompile: *IsPromise native promise.js:114:29 | |
3468 19.3% 3468 19.3% /Users/bajtos/src/io.js/out/Release/node | |
967 5.4% 41 0.2% LazyCompile: ~resolveStatCompletion /Users/bajtos/src/io.js/benchmark/fs/promised-stat.js:148:52 | |
921 5.1% 35 0.2% LazyCompile: ~<anonymous> native promise.js:28:11 | |
872 4.9% 8 0.0% LazyCompile: *PromiseResolve native promise.js:120:39 | |
852 4.7% 12 0.1% LazyCompile: *PromiseDone native promise.js:50:21 | |
521 2.9% 17 0.1% LazyCompile: *PromiseSet native promise.js:36:20 | |
492 2.7% 7 0.0% /Users/bajtos/src/io.js/out/Release/node | |
472 2.6% 472 2.6% /Users/bajtos/src/io.js/out/Release/node | |
262 1.5% 8 0.0% LazyCompile: *PromiseEnqueue native promise.js:92:24 | |
242 1.3% 3 0.0% /Users/bajtos/src/io.js/out/Release/node | |
222 1.2% 222 1.2% /Users/bajtos/src/io.js/out/Release/node | |
34 0.2% 34 0.2% KeyedLoadIC: A keyed load IC from the snapshot | |
893 5.0% 132 0.7% LazyCompile: *fs.Stats fs.js:120:20 | |
557 3.1% 102 0.6% LazyCompile: *Date native date.js:62:25 | |
428 2.4% 19 0.1% /Users/bajtos/src/io.js/out/Release/node | |
341 1.9% 341 1.9% /Users/bajtos/src/io.js/out/Release/node | |
56 0.3% 56 0.3% /usr/lib/system/libsystem_m.dylib | |
27 0.2% 27 0.2% Stub: CEntryStub | |
103 0.6% 103 0.6% Builtin: A builtin from the snapshot | |
48 0.3% 48 0.3% Builtin: A builtin from the snapshot {1} | |
42 0.2% 42 0.2% Stub: CallConstructStub | |
287 1.6% 287 1.6% /usr/lib/system/libsystem_kernel.dylib | |
125 0.7% 125 0.7% /usr/lib/system/libsystem_platform.dylib | |
100 0.6% 100 0.6% Builtin: A builtin from the snapshot | |
65 0.4% 65 0.4% /usr/lib/system/libsystem_malloc.dylib | |
51 0.3% 51 0.3% Stub: JSEntryStub {1} | |
43 0.2% 43 0.2% Builtin: A builtin from the snapshot {2} | |
41 0.2% 41 0.2% Builtin: A builtin from the snapshot {4} | |
40 0.2% 0 0.0% Function: ~<anonymous> node.js:30:10 | |
38 0.2% 0 0.0% LazyCompile: ~startup node.js:33:19 | |
37 0.2% 37 0.2% Stub: JSEntryStub | |
33 0.2% 33 0.2% Stub: CallConstructStub | |
32 0.2% 32 0.2% /usr/lib/system/libsystem_pthread.dylib | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In bluebird you would implement it like