Permalink
Browse files

fixed streamline benchmarks (#1233)

* fixed streamline benchmarks

* fix warning about obsolete regenerator dependency in streamline callbacks benchmark
  • Loading branch information...
1 parent dc267aa commit c4b2a6e9de029690bb48b4cc1d4c7b84a92c36ab @bjouhier bjouhier committed with Dec 29, 2016
@@ -1,43 +1,98 @@
-/*** Generated by streamline 0.10.17 (callbacks) - DO NOT EDIT ***/ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename, false),__func=__rt.__func,__cb=__rt.__cb,__catch=__rt.__catch,__tryCatch=__rt.__tryCatch; require("../lib/fakes");
-
-module.exports = function upload(stream, idOrPath, tag, _) { var blob, tx, blobId, file, previousId, splitPath, fileName, query; var __frame = { name: "upload", line: 3 }; return __func(_, this, arguments, upload, 3, __frame, function __$upload() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$upload() {
-
- blob = blobManager.create(account);
- tx = db.begin();
- return blob.put(stream, __cb(_, __frame, 4, 26, function ___(__0, __1) { blobId = __1;
- return self.byUuidOrPath(idOrPath).get(__cb(_, __frame, 5, 47, function ___(__0, __2) { file = __2;
-
- 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, __cb(_, __frame, 16, 32, function __$upload() {
- triggerIntentionalError(); return (function __$upload(__then) {
- if (!file) {
- splitPath = idOrPath.split("/");
- fileName = splitPath[(splitPath.length - 1)];
+'use strict';
+
+var regeneratorRuntime = typeof require === 'function' ? require('streamline-runtime/lib/callbacks/regenerator') : Streamline.require('streamline-runtime/lib/callbacks/regenerator');
+
+var _streamline = typeof require === 'function' ? require('streamline-runtime/lib/callbacks/runtime') : Streamline.require('streamline-runtime/lib/callbacks/runtime');
+
+var _filename = '/Users/bruno/dev/bluebird/benchmark/doxbee-sequential-errors/streamline._js';
+require('../lib/fakes');
+
+module.exports = _streamline.async(regeneratorRuntime.mark(function _$$upload$$(stream, idOrPath, tag, _2) {
+ var blob, tx, blobId, file, previousId, version, splitPath, fileName, query;
+ return regeneratorRuntime.wrap(function _$$upload$$$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ _context.prev = 0;
+ blob = blobManager.create(account);
+ tx = db.begin();
+ _context.next = 5;
+ return _streamline.await(_filename, 7, blob, 'put', 1, null, false, [stream, true]);
+
+ case 5:
+ blobId = _context.sent;
+ _context.next = 8;
+ return _streamline.await(_filename, 8, self.byUuidOrPath(idOrPath), 'get', 0, null, false, [true]);
+
+ case 8:
+ file = _context.sent;
+ previousId = file ? file.version : null;
+ version = {
+ userAccountId: userAccount.id,
+ date: new Date(),
+ blobId: blobId,
+ creatorId: userAccount.id,
+ previousId: previousId
+ };
+
+ version.id = Version.createHash(version);
+ _context.next = 14;
+ return _streamline.await(_filename, 19, Version.insert(version), 'execWithin', 1, null, false, [tx, true]);
+
+ case 14:
+ triggerIntentionalError();
+
+ if (file) {
+ _context.next = 25;
+ break;
+ }
+
+ splitPath = idOrPath.split('/');
+ fileName = splitPath[splitPath.length - 1];
+
file = {
- id: uuid.v1(),
- userAccountId: userAccount.id,
- name: fileName,
- version: version.id };
+ id: uuid.v1(),
+ userAccountId: userAccount.id,
+ name: fileName,
+ version: version.id
+ };
+ _context.next = 21;
+ return _streamline.await(_filename, 30, self, 'createQuery', 2, null, false, [idOrPath, file, true]);
+
+ case 21:
+ query = _context.sent;
+ _context.next = 24;
+ return _streamline.await(_filename, 31, query, 'execWithin', 1, null, false, [tx, true]);
- return self.createQuery(idOrPath, file, __cb(_, __frame, 27, 29, function ___(__0, __3) { query = __3;
- return query.execWithin(tx, __cb(_, __frame, 28, 18, function __$upload() {
- triggerIntentionalError(); __then(); }, true)); }, true)); } else { __then(); } ; })(function __$upload() {
+ case 24:
+ triggerIntentionalError();
+
+ case 25:
+ _context.next = 27;
+ return _streamline.await(_filename, 34, FileVersion.insert({ fileId: file.id, versionId: version.id }), 'execWithin', 1, null, false, [tx, true]);
+ case 27:
+ triggerIntentionalError();
+ _context.next = 30;
+ return _streamline.await(_filename, 37, File.whereUpdate({ id: file.id }, { version: version.id }), 'execWithin', 1, null, false, [tx, true]);
- return FileVersion.insert({ fileId: file.id, versionId: version.id }).execWithin(tx, __cb(_, __frame, 32, 13, function __$upload() {
+ case 30:
triggerIntentionalError();
+ tx.commit();
+ _context.next = 38;
+ break;
+
+ case 34:
+ _context.prev = 34;
+ _context.t0 = _context['catch'](0);
- return File.whereUpdate({ id: file.id }, { version: version.id }).execWithin(tx, __cb(_, __frame, 35, 13, function __$upload() {
- triggerIntentionalError();
- tx.commit(); __then(); }, true)); }, true)); }); }, true)); }, true)); }, true)); }); })(function ___(err, __result) { __catch(function __$upload() { if (err) {
+ tx.rollback();
+ throw _context.t0;
- tx.rollback();
- return _(err); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$upload() { _(); }); }); });};
+ case 38:
+ case 'end':
+ return _context.stop();
+ }
+ }
+ }, _$$upload$$, this, [[0, 34]]);
+}), 3, 4);
@@ -1,48 +1,50 @@
-/*** Generated by streamline 0.10.17 (generators) - DO NOT EDIT ***/var galaxy = require("streamline/lib/generators/runtime");(function(){})();(galaxy.unstar(function*(_) { require('../lib/fakes');
+'use strict';
-module.exports = galaxy.unstar(function* upload(stream, idOrPath, tag, _) {
- try {
- var blob = blobManager.create(account);
- var tx = db.begin();
- var blobId = (yield galaxy.invoke(blob, "put", [stream, _], 1));
- var file = (yield galaxy.invoke(self.byUuidOrPath(idOrPath), "get", [_], 0));
+var _streamline = typeof require === 'function' ? require('streamline-runtime/lib/generators/runtime') : Streamline.require('streamline-runtime/lib/generators/runtime');
- 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);
- (yield galaxy.invoke(Version.insert(version), "execWithin", [tx, _], 1));
- triggerIntentionalError();
- if (!file) {
- var splitPath = idOrPath.split('/');
- var fileName = splitPath[splitPath.length - 1];
- file = {
- id: uuid.v1(),
+var _filename = '/Users/bruno/dev/bluebird/benchmark/doxbee-sequential-errors/streamline._js';
+require('../lib/fakes');
+
+module.exports = _streamline.async(function* _$$upload$$(stream, idOrPath, tag, _2) {
+ {
+ try {
+ var blob = blobManager.create(account);
+ var tx = db.begin();
+ var blobId = yield _streamline.await(_filename, 7, blob, 'put', 1, null, false, [stream, true]);
+ var file = yield _streamline.await(_filename, 8, self.byUuidOrPath(idOrPath), 'get', 0, null, false, [true]);
+
+ var previousId = file ? file.version : null;
+ var version = {
userAccountId: userAccount.id,
- name: fileName,
- version: version.id
+ date: new Date(),
+ blobId: blobId,
+ creatorId: userAccount.id,
+ previousId: previousId
};
- var query = (yield galaxy.invoke(self, "createQuery", [idOrPath, file, _], 2));
- (yield galaxy.invoke(query, "execWithin", [tx, _], 1));
+ version.id = Version.createHash(version);
+ yield _streamline.await(_filename, 19, Version.insert(version), 'execWithin', 1, null, false, [tx, true]);
+ triggerIntentionalError();
+ if (!file) {
+ var splitPath = idOrPath.split('/');
+ var fileName = splitPath[splitPath.length - 1];
+ file = {
+ id: uuid.v1(),
+ userAccountId: userAccount.id,
+ name: fileName,
+ version: version.id
+ };
+ var query = yield _streamline.await(_filename, 30, self, 'createQuery', 2, null, false, [idOrPath, file, true]);
+ yield _streamline.await(_filename, 31, query, 'execWithin', 1, null, false, [tx, true]);
+ triggerIntentionalError();
+ }
+ yield _streamline.await(_filename, 34, FileVersion.insert({ fileId: file.id, versionId: version.id }), 'execWithin', 1, null, false, [tx, true]);
+ triggerIntentionalError();
+ yield _streamline.await(_filename, 37, File.whereUpdate({ id: file.id }, { version: version.id }), 'execWithin', 1, null, false, [tx, true]);
triggerIntentionalError();
+ tx.commit();
+ } catch (err) {
+ tx.rollback();
+ throw err;
}
- (yield galaxy.invoke(FileVersion.insert({fileId: file.id, versionId: version.id}), "execWithin", [
- tx, _], 1));
- triggerIntentionalError();
- (yield galaxy.invoke(File.whereUpdate({id: file.id}, {version: version.id}), "execWithin", [
- tx, _], 1));
- triggerIntentionalError();
- tx.commit();
- } catch (err) {
- tx.rollback();
- throw err;
}
-}, 3);
-}, 0).call(this, function(err) {
- if (err) throw err;
-}));
+}, 3, 4);
@@ -8,7 +8,7 @@ module.exports = function upload(stream, idOrPath, tag, _) {
var file = self.byUuidOrPath(idOrPath).get(_);
var previousId = file ? file.version : null;
- version = {
+ var version = {
userAccountId: userAccount.id,
date: new Date(),
blobId: blobId,
@@ -1,39 +1,91 @@
-/*** Generated by streamline 0.10.17 (callbacks) - DO NOT EDIT ***/ var __rt=require('streamline/lib/callbacks/runtime').runtime(__filename, false),__func=__rt.__func,__cb=__rt.__cb,__catch=__rt.__catch,__tryCatch=__rt.__tryCatch; require("../lib/fakes");
-
-module.exports = function upload(stream, idOrPath, tag, _) { var blob, tx, blobId, file, previousId, splitPath, fileName, query; var __frame = { name: "upload", line: 3 }; return __func(_, this, arguments, upload, 3, __frame, function __$upload() { return (function ___(__then) { (function ___(_) { __tryCatch(_, function __$upload() {
-
- blob = blobManager.create(account);
- tx = db.begin();
- return blob.put(stream, __cb(_, __frame, 4, 26, function ___(__0, __1) { blobId = __1;
- return self.byUuidOrPath(idOrPath).get(__cb(_, __frame, 5, 47, function ___(__0, __2) { file = __2;
-
- 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, __cb(_, __frame, 16, 32, function __$upload() { return (function __$upload(__then) {
- if (!file) {
- splitPath = idOrPath.split("/");
- fileName = splitPath[(splitPath.length - 1)];
+'use strict';
+
+var regeneratorRuntime = typeof require === 'function' ? require('streamline-runtime/lib/callbacks/regenerator') : Streamline.require('streamline-runtime/lib/callbacks/regenerator');
+
+var _streamline = typeof require === 'function' ? require('streamline-runtime/lib/callbacks/runtime') : Streamline.require('streamline-runtime/lib/callbacks/runtime');
+
+var _filename = '/Users/bruno/dev/bluebird/benchmark/doxbee-sequential/streamline._js';
+require('../lib/fakes');
+
+module.exports = _streamline.async(regeneratorRuntime.mark(function _$$upload$$(stream, idOrPath, tag, _2) {
+ var blob, tx, blobId, file, previousId, version, splitPath, fileName, query;
+ return regeneratorRuntime.wrap(function _$$upload$$$(_context) {
+ while (1) {
+ switch (_context.prev = _context.next) {
+ case 0:
+ _context.prev = 0;
+ blob = blobManager.create(account);
+ tx = db.begin();
+ _context.next = 5;
+ return _streamline.await(_filename, 7, blob, 'put', 1, null, false, [stream, true]);
+
+ case 5:
+ blobId = _context.sent;
+ _context.next = 8;
+ return _streamline.await(_filename, 8, self.byUuidOrPath(idOrPath), 'get', 0, null, false, [true]);
+
+ case 8:
+ file = _context.sent;
+ previousId = file ? file.version : null;
+ version = {
+ userAccountId: userAccount.id,
+ date: new Date(),
+ blobId: blobId,
+ creatorId: userAccount.id,
+ previousId: previousId
+ };
+
+ version.id = Version.createHash(version);
+ _context.next = 14;
+ return _streamline.await(_filename, 19, Version.insert(version), 'execWithin', 1, null, false, [tx, true]);
+
+ case 14:
+ if (file) {
+ _context.next = 23;
+ break;
+ }
+
+ splitPath = idOrPath.split('/');
+ fileName = splitPath[splitPath.length - 1];
+
file = {
- id: uuid.v1(),
- userAccountId: userAccount.id,
- name: fileName,
- version: version.id };
+ id: uuid.v1(),
+ userAccountId: userAccount.id,
+ name: fileName,
+ version: version.id
+ };
+ _context.next = 20;
+ return _streamline.await(_filename, 29, self, 'createQuery', 2, null, false, [idOrPath, file, true]);
+
+ case 20:
+ query = _context.sent;
+ _context.next = 23;
+ return _streamline.await(_filename, 30, query, 'execWithin', 1, null, false, [tx, true]);
+
+ case 23:
+ _context.next = 25;
+ return _streamline.await(_filename, 32, FileVersion.insert({ fileId: file.id, versionId: version.id }), 'execWithin', 1, null, false, [tx, true]);
- return self.createQuery(idOrPath, file, __cb(_, __frame, 26, 29, function ___(__0, __3) { query = __3;
- return query.execWithin(tx, __cb(_, __frame, 27, 18, __then, true)); }, true)); } else { __then(); } ; })(function __$upload() {
+ case 25:
+ _context.next = 27;
+ return _streamline.await(_filename, 34, File.whereUpdate({ id: file.id }, { version: version.id }), 'execWithin', 1, null, false, [tx, true]);
+ case 27:
+ tx.commit();
+ _context.next = 34;
+ break;
- return FileVersion.insert({ fileId: file.id, versionId: version.id }).execWithin(tx, __cb(_, __frame, 30, 13, function __$upload() {
+ case 30:
+ _context.prev = 30;
+ _context.t0 = _context['catch'](0);
- return File.whereUpdate({ id: file.id }, { version: version.id }).execWithin(tx, __cb(_, __frame, 32, 13, function __$upload() {
- tx.commit(); __then(); }, true)); }, true)); }); }, true)); }, true)); }, true)); }); })(function ___(err, __result) { __catch(function __$upload() { if (err) {
+ tx.rollback();
+ throw _context.t0;
- tx.rollback();
- return _(err); } else { _(null, __result); } ; }, _); }); })(function ___() { __tryCatch(_, function __$upload() { _(); }); }); });};
+ case 34:
+ case 'end':
+ return _context.stop();
+ }
+ }
+ }, _$$upload$$, this, [[0, 30]]);
+}), 3, 4);
Oops, something went wrong.

0 comments on commit c4b2a6e

Please sign in to comment.