Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
meta: merge node/master into node-chakracore/master
Browse files Browse the repository at this point in the history
Merge 4a49833 as of 2018-01-29
This commit was automatically generated. For any problems, please contact jackhorton

Reviewed-By: Jimmy Thomson <jithomso@microsoft.com>
  • Loading branch information
chakrabot committed Feb 8, 2018
2 parents a38d27e + 4a49833 commit 086bab5
Show file tree
Hide file tree
Showing 40 changed files with 528 additions and 391 deletions.
9 changes: 6 additions & 3 deletions benchmark/_http-benchmarkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,14 @@ class TestDoubleBenchmarker {
}

create(options) {
const env = Object.assign({
duration: options.duration,
test_url: `http://127.0.0.1:${options.port}${options.path}`,
}, process.env);

const child = child_process.fork(this.executable, {
silent: true,
env: Object.assign({}, process.env, {
test_url: `http://127.0.0.1:${options.port}${options.path}`
})
env
});
return child;
}
Expand Down
28 changes: 25 additions & 3 deletions benchmark/_test-double-benchmarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

const http = require('http');

http.get(process.env.test_url, function() {
console.log(JSON.stringify({ throughput: 1 }));
});
const duration = process.env.duration || 0;
const url = process.env.test_url;

const start = process.hrtime();
let throughput = 0;

function request(res) {
res.on('data', () => {});
res.on('error', () => {});
res.on('end', () => {
throughput++;
const diff = process.hrtime(start);
if (duration > 0 && diff[0] < duration) {
run();
} else {
console.log(JSON.stringify({ throughput }));
}
});
}

function run() {
http.get(url, request);
}

run();
61 changes: 49 additions & 12 deletions benchmark/compare.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ if (!is.null(plot.filename)) {
ggsave(plot.filename, p);
}

# computes the shared standard error, as used in the welch t-test
welch.sd = function (old.rate, new.rate) {
old.se.squared = var(old.rate) / length(old.rate)
new.se.squared = var(new.rate) / length(new.rate)
return(sqrt(old.se.squared + new.se.squared))
}

# calculate the improvement confidence interval. The improvement is calculated
# by dividing by old.mu and not new.mu, because old.mu is what the mean
# improvement is calculated relative to.
confidence.interval = function (shared.se, old.mu, w, risk) {
interval = qt(1 - (risk / 2), w$parameter) * shared.se;
return(sprintf("±%.2f%%", (interval / old.mu) * 100))
}

# Print a table with results
statistics = ddply(dat, "name", function(subdat) {
old.rate = subset(subdat, binary == "old")$rate;
Expand All @@ -45,33 +60,42 @@ statistics = ddply(dat, "name", function(subdat) {
new.mu = mean(new.rate);
improvement = sprintf("%.2f %%", ((new.mu - old.mu) / old.mu * 100));

p.value = NA;
confidence = 'NA';
r = list(
confidence = "NA",
improvement = improvement,
"accuracy (*)" = "NA",
"(**)" = "NA",
"(***)" = "NA"
);

# Check if there is enough data to calculate the calculate the p-value
if (length(old.rate) > 1 && length(new.rate) > 1) {
# Perform a statistics test to see of there actually is a difference in
# performance.
w = t.test(rate ~ binary, data=subdat);
p.value = w$p.value;
shared.se = welch.sd(old.rate, new.rate)

# Add user friendly stars to the table. There should be at least one star
# before you can say that there is an improvement.
confidence = '';
if (p.value < 0.001) {
if (w$p.value < 0.001) {
confidence = '***';
} else if (p.value < 0.01) {
} else if (w$p.value < 0.01) {
confidence = '**';
} else if (p.value < 0.05) {
} else if (w$p.value < 0.05) {
confidence = '*';
}

r = list(
confidence = confidence,
improvement = improvement,
"accuracy (*)" = confidence.interval(shared.se, old.mu, w, 0.05),
"(**)" = confidence.interval(shared.se, old.mu, w, 0.01),
"(***)" = confidence.interval(shared.se, old.mu, w, 0.001)
);
}

r = list(
improvement = improvement,
confidence = confidence,
p.value = p.value
);
return(data.frame(r));
return(data.frame(r, check.names=FALSE));
});


Expand All @@ -81,3 +105,16 @@ statistics$name = NULL;

options(width = 200);
print(statistics);
cat("\n")
cat(sprintf(
"Be aware that when doing many comparisions the risk of a false-positive
result increases. In this case there are %d comparisions, you can thus
expect the following amount of false-positive results:
%.2f false positives, when considering a 5%% risk acceptance (*, **, ***),
%.2f false positives, when considering a 1%% risk acceptance (**, ***),
%.2f false positives, when considering a 0.1%% risk acceptance (***)
",
nrow(statistics),
nrow(statistics) * 0.05,
nrow(statistics) * 0.01,
nrow(statistics) * 0.001))
2 changes: 2 additions & 0 deletions doc/api/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,8 @@ changes:
* `exec` {string} File path to worker file. **Default:** `process.argv[1]`
* `args` {Array} String arguments passed to worker.
**Default:** `process.argv.slice(2)`
* `cwd` {string} Current working directory of the worker process. **Default:**
`undefined` (inherits from parent process)
* `silent` {boolean} Whether or not to send output to parent's stdio.
**Default:** `false`
* `stdio` {Array} Configures the stdio of forked processes. Because the
Expand Down
Loading

0 comments on commit 086bab5

Please sign in to comment.