Skip to content

Commit

Permalink
enable ES6 syntax for profiling
Browse files Browse the repository at this point in the history
just use "npm run build-es6" instead of "npm run build" and the
/dist/creed.js file will contain native ES6 except for the module syntax

benchmarks will automatically use it instead of /src/main.js as entry point
  • Loading branch information
bergus committed Jul 23, 2016
1 parent 5dcab43 commit 0d44e84
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,3 +2,4 @@
experiments/
node_modules/
coverage/
perf/logs/
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -27,6 +27,7 @@
],
"scripts": {
"build-dist": "mkdirp dist && rollup -c",
"build-es6": "mkdirp dist && rollup -f cjs -o dist/creed.js src/main.js",
"build": "npm run build-dist && uglifyjs -c \"warnings=false\" -m -o dist/creed.min.js -- dist/creed.js",
"preversion": "npm run build",
"check-coverage": "istanbul check-coverage --statements 100 --branches 100 --lines 100 --functions 100 coverage/coverage*.json",
Expand Down
2 changes: 1 addition & 1 deletion perf/doxbee-sequential-errors/promises-creed-algebraic.js
Expand Up @@ -2,7 +2,7 @@ global.useCreed = true;
global.useQ = false;
global.useBluebird = false;

var creed = require('../../dist/creed');
var creed = require('../..');

require('../lib/fakesP');

Expand Down
2 changes: 1 addition & 1 deletion perf/doxbee-sequential-errors/promises-creed-generator.js
Expand Up @@ -2,7 +2,7 @@ global.useCreed = true;
global.useQ = false;
global.useBluebird = false;

var creed = require('../../dist/creed');
var creed = require('../..');

require('../lib/fakesP');

Expand Down
2 changes: 1 addition & 1 deletion perf/doxbee-sequential-errors/promises-creed.js
Expand Up @@ -2,7 +2,7 @@ global.useCreed = true;
global.useQ = false;
global.useBluebird = false;

var creed = require('../../dist/creed');
var creed = require('../..');

require('../lib/fakesP');

Expand Down
2 changes: 1 addition & 1 deletion perf/doxbee-sequential/promises-creed-algebraic.js
Expand Up @@ -2,7 +2,7 @@ global.useCreed = true;
global.useQ = false;
global.useBluebird = false;

var creed = require('../../dist/creed');
var creed = require('../..');

require('../lib/fakesP');

Expand Down
2 changes: 1 addition & 1 deletion perf/doxbee-sequential/promises-creed-generator.js
@@ -1,7 +1,7 @@
global.useBluebird = false;
global.useQ = false;
global.useCreed = true;
var creed = require('../../dist/creed');
var creed = require('../..');
require('../lib/fakesP');

module.exports = creed.coroutine(function* upload(stream, idOrPath, tag, done) {
Expand Down
2 changes: 1 addition & 1 deletion perf/doxbee-sequential/promises-creed.js
Expand Up @@ -2,7 +2,7 @@ global.useCreed = true;
global.useQ = false;
global.useBluebird = false;

var creed = require('../../dist/creed');
var creed = require('../..');

require('../lib/fakesP');

Expand Down
2 changes: 1 addition & 1 deletion perf/lib/fakesP.js
Expand Up @@ -83,7 +83,7 @@ else if (global.useNative) {
};
}
else if (global.useCreed) {
var lifter = require('../../dist/creed').fromNode;
var lifter = require('../..').fromNode;
}
else {
var lifter = require('when/node').lift;
Expand Down
2 changes: 1 addition & 1 deletion perf/madeup-parallel/promises-creed-generator.js
Expand Up @@ -3,7 +3,7 @@ global.useQ = false;
global.useWhen = false;

global.useCreed = true;
var creed = require('../../dist/creed');
var creed = require('../..');
require('../lib/fakesP');

module.exports = creed.coroutine(function* upload(stream, idOrPath, tag, done) {
Expand Down
2 changes: 1 addition & 1 deletion perf/madeup-parallel/promises-creed.js
Expand Up @@ -4,7 +4,7 @@ global.useWhen = false;

global.useCreed = true;

var creed = require('../../dist/creed');
var creed = require('../..');

require('../lib/fakesP');

Expand Down
3 changes: 1 addition & 2 deletions perf/performance.js
@@ -1,6 +1,5 @@

var args = require('optimist').argv;

var path = require('path');

global.LIKELIHOOD_OF_REJECTION = args.e || 0.1;
Expand Down Expand Up @@ -138,7 +137,7 @@ function measure(files, requests, time, parg, callback) {
async.mapSeries(files, function(f, done) {
console.log("benchmarking", f);
var logFile = path.basename(f) + ".log";
var profileFlags = ["--prof", "--logfile=C:/etc/v8/" + logFile];
var profileFlags = ["--prof", "--logfile=logs/" + logFile];

var argsFork = [__filename,
'--n', requests,
Expand Down
4 changes: 2 additions & 2 deletions src/main.js
Expand Up @@ -30,7 +30,7 @@ export {
// coroutine :: Generator e a -> (...* -> Promise e a)
// Make a coroutine from a promise-yielding generator
export function coroutine (generator) {
return function (...args) {
return function coroutinified (...args) {
return runGenerator(generator, this, args)
}
}
Expand All @@ -50,7 +50,7 @@ function runGenerator (generator, thisArg, args) {
// fromNode :: NodeApi e a -> (...args -> Promise e a)
// Turn a Node API into a promise API
export function fromNode (f) {
return function (...args) {
return function promisified (...args) {
return runResolver(_runNode, f, this, args, new Future())
}
}
Expand Down

0 comments on commit 0d44e84

Please sign in to comment.