Warmup benchmarks

Reviewed-by: asquare
This commit is contained in:
Kinsley Wong 2013-11-14 10:50:19 -08:00
parent 587d279219
commit 66527926ac
2 changed files with 39 additions and 0 deletions

View File

@ -64,6 +64,7 @@
<property name="patches.dir" location="${basedir}/patches"/>
<property name="test.dir" location="${basedir}/test"/>
<property name="benchmark.dir" location="${basedir}/benchmark"/>
<property name="build.properties.file" location="${classes.dir}/build.properties"/>
<property name="native.build.dir" value="${basedir}/out/${build.type}/obj.target/${product.name}/"/>
@ -335,6 +336,8 @@
<apply-diff src="test/simple" mod="${test.dir}/crypto" name="test-crypto.js"/>
<apply-diff src="test/simple" mod="${test.dir}/crypto" name="test-crypto-binary-default.js"/>
<apply-diff src="test/pummel" mod="${test.dir}/crypto" name="test-crypto-dh.js"/>
<!-- benchmark -->
<apply-diff src="benchmark" mod="${benchmark.dir}" name="common.js"/>
</target>
<!-- keep sorted and synchronized with diff-source-files -->
@ -399,6 +402,8 @@
<apply-patch-file target="${test.dir}/crypto" dir="test/crypto" name="test-crypto.js"/>
<apply-patch-file target="${test.dir}/crypto" dir="test/crypto" name="test-crypto-binary-default.js"/>
<apply-patch-file target="${test.dir}/crypto" dir="test/crypto" name="test-crypto-dh.js"/>
<!-- benchmark -->
<apply-patch-file target="${benchmark.dir}" dir="benchmark" name="common.js"/>
</target>
<target name="generate-policy-file" depends="init">

View File

@ -0,0 +1,34 @@
--- ../nodejs/benchmark/common.js 2013-09-05 16:07:32.462830000 -0700
+++ benchmark/common.js 2013-11-13 18:05:47.148644300 -0800
@@ -1,6 +1,8 @@
var assert = require('assert');
var path = require('path');
var silent = +process.env.NODE_BENCH_SILENT;
+var started = false;
+var warmUp = true;
exports.PORT = process.env.PORT || 12346;
@@ -21,9 +23,21 @@
}
function runBenchmarks() {
+ if (warmUp && !started) {
+ console.error("**** START WARMUP ****");
+ started = true;
+ }
var test = tests.shift();
- if (!test)
+ if (!test) {
+ if (warmUp) {
+ console.error("**** FINISH WARMUP ****");
+ warmUp = false;
+ started = false;
+ tests = fs.readdirSync(dir);
+ runBenchmarks();
+ }
return;
+ }
if (test.match(/^[\._]/))
return process.nextTick(runBenchmarks);