Skip to content

Instantly share code, notes, and snippets.

@briancavalier
Created May 15, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briancavalier/cc74cce25fcc94362e6c to your computer and use it in GitHub Desktop.
Save briancavalier/cc74cce25fcc94362e6c to your computer and use it in GitHub Desktop.
most.js results for Bluebird doxbee perf test
global.useMost = true;
var most = require('most');
require('../lib/fakesObservable');
module.exports = function upload(stream, idOrPath, tag, done) {
var blob = blobManager.create(account);
var tx = db.begin();
var blobIdP = blob.put(stream);
var fileP = self.byUuidOrPath(idOrPath).get();
var version, fileId, file;
most.combine(Array, blobIdP, fileP).flatMap(function(v) {
file = v[1];
var blobId = v[0];
var previousId = file ? file.version : null;
version = {
userAccountId: userAccount.id,
date: new Date(),
blobId: blobId,
creatorId: userAccount.id,
previousId: previousId,
};
version.id = Version.createHash(version);
return Version.insert(version).execWithin(tx);
}).flatMap(function() {
if (!file) {
var splitPath = idOrPath.split('/');
var fileName = splitPath[splitPath.length - 1];
var newId = uuid.v1();
return self.createQuery(idOrPath, {
id: newId,
userAccountId: userAccount.id,
name: fileName,
version: version.id
}).flatMap(function(q) {
return q.execWithin(tx);
}).constant(newId);
} else {
return most.of(file.id);
}
}).flatMap(function(fileIdV) {
fileId = fileIdV;
return FileVersion.insert({
fileId: fileId,
versionId: version.id
}).execWithin(tx);
}).flatMap(function() {
return File.whereUpdate({id: fileId}, {version: version.id})
.execWithin(tx);
})
.observe(function() {
tx.commit();
done();
}).catch(function() {
tx.rollback();
done(err);
});
}
Doxbee sequential
benchmarking ./doxbee-sequential/callbacks-baseline.js
{"time":81,"mem":14.3828125,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/callbacks-caolan-async-waterfall.js
{"time":255,"mem":54.5546875,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/generators-tj-co.js
{"time":454,"mem":66.19140625,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/observables-Reactive-Extensions-RxJS.js
{"time":1280,"mem":151.19140625,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/observables-baconjs-bacon.js.js
{"time":6951,"mem":340.21875,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/observables-caolan-highland.js
{"time":8461,"mem":240.0859375,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/observables-cujojs-most.js
{"time":375,"mem":66.40625,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/promises-bluebird-generator.js
{"time":94,"mem":16.62109375,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/promises-bluebird.js
{"time":134,"mem":30.2890625,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/promises-calvinmetcalf-lie.js
{"time":276,"mem":74.6796875,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/promises-cujojs-when-generator.js
{"time":100,"mem":23.765625,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/promises-cujojs-when.js
{"time":156,"mem":37.28125,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/promises-dfilatov-vow.js
{"time":298,"mem":73.03125,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/promises-ecmascript6-native.js
{"time":403,"mem":97.828125,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/promises-kriskowal-q.js
{"time":2850,"mem":448.73828125,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/promises-lvivski-davy.js
{"time":243,"mem":59.546875,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/promises-medikoo-deferred.js
{"time":811,"mem":101.140625,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/promises-obvious-kew.js
{"time":530,"mem":124.82421875,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/promises-then-promise.js
{"time":501,"mem":130.4921875,"errors":0,"lastErr":null}
benchmarking ./doxbee-sequential/promises-tildeio-rsvp.js
{"time":163,"mem":51.10546875,"errors":0,"lastErr":null}
results for 5000 parallel executions, 1 ms per I/O op
file time(ms) memory(MB)
callbacks-baseline.js 81 14.38
promises-bluebird-generator.js 94 16.62
promises-cujojs-when-generator.js 100 23.77
promises-bluebird.js 134 30.29
promises-cujojs-when.js 156 37.28
promises-tildeio-rsvp.js 163 51.11
promises-lvivski-davy.js 243 59.55
callbacks-caolan-async-waterfall.js 255 54.55
promises-calvinmetcalf-lie.js 276 74.68
promises-dfilatov-vow.js 298 73.03
observables-cujojs-most.js 375 66.41
promises-ecmascript6-native.js 403 97.83
generators-tj-co.js 454 66.19
promises-then-promise.js 501 130.49
promises-obvious-kew.js 530 124.82
promises-medikoo-deferred.js 811 101.14
observables-Reactive-Extensions-RxJS.js 1280 151.19
promises-kriskowal-q.js 2850 448.74
observables-baconjs-bacon.js.js 6951 340.22
observables-caolan-highland.js 8461 240.09
Platform info:
Darwin 14.3.0 x64
Node.JS 2.0.0
V8 4.2.77.18
Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz × 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment