Permalink
Browse files

put benchmark script in TMPDIR instead of project

Too tedious to continually switch back and forth between tests and
profiling
  • Loading branch information...
1 parent 97a5fd6 commit 367f9ec2748d14779841a5e1ffda39dec8359628 @isaacs committed Nov 16, 2014
Showing with 28 additions and 17 deletions.
  1. +4 −0 benchclean.sh
  2. +8 −6 benchmark.sh
  3. +5 −3 make-benchmark-fixture.sh
  4. +3 −3 package.json
  5. +7 −5 prof.sh
  6. +1 −0 test/bash-results.json
View
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+tmp=${TMPDIR:-/tmp}
+rm -rf $tmp/benchmark-fixture v8.log profile.txt
View
@@ -1,8 +1,10 @@
#!/bin/bash
export CDPATH=
+tmp=${TMPDIR:-/tmp}
bash make-benchmark-fixture.sh
-cd benchmark-fixture
+wd=$PWD
+cd $tmp/benchmark-fixture
set -e
@@ -38,18 +40,18 @@ echo
echo Node glob.sync timing:
time node -e '
- var glob=require("../");
- console.log(glob.sync("**/*.txt").length);'
+ var glob=require(process.argv[1]);
+ console.log(glob.sync("**/*.txt").length);' "$wd"
echo
echo Node glob async timing:
time node -e '
- var glob=require("../");
+ var glob=require(process.argv[1]);
glob("**/*.txt", function (er, files) {
console.log(files.length)
- })'
+ })' "$wd"
echo
echo Node glob with --prof
-cd ..
+cd $wd
bash prof.sh
@@ -1,10 +1,12 @@
#!/bin/bash
+
+tmp=${TMPDIR:-/tmp}
export CDPATH=
set -e
-if ! [ -d benchmark-fixture ]; then
+if ! [ -d $tmp/benchmark-fixture ]; then
echo Making benchmark fixtures
- mkdir benchmark-fixture
- cd benchmark-fixture
+ mkdir $tmp/benchmark-fixture
+ cd $tmp/benchmark-fixture
dirnames=`echo {0..9}/{0..9}/{0..9}/{0..9}` # 10000 dirs
filenames=`echo {0..9}/{0..9}/{0..9}/{0..9}/{0..9}.txt`
echo $dirnames | xargs mkdir -p
View
@@ -25,11 +25,11 @@
},
"scripts": {
"prepublish": "npm run benchclean",
- "test": "npm run benchclean; tap test/*.js",
- "test-regen": "npm run benchclean; TEST_REGEN=1 node test/00-setup.js",
+ "test": "rm v8.log profile.txt; tap test/*.js",
+ "test-regen": "rm v8.log profile.txt; TEST_REGEN=1 node test/00-setup.js",
"bench": "bash benchmark.sh",
"prof": "bash prof.sh && cat profile.txt",
- "benchclean": "rm -rf benchmark-fixture v8.log profile.txt"
+ "benchclean": "bash benchclean.sh"
},
"license": "ISC"
}
View
@@ -2,16 +2,18 @@
export CDPATH=
set -e
+tmp=${TMPDIR:-/tmp}
bash make-benchmark-fixture.sh
-cd benchmark-fixture
+wd=$PWD
+cd $tmp/benchmark-fixture
node --prof -e '
- var glob=require("../");
+ var glob=require(process.argv[1]);
glob("**/*.txt", function (er, files) {
console.log(files.length)
})
//console.log(glob.sync("**/*.txt").length);
- '
-mv v8.log ..
-cd ..
+ ' "$wd"
+mv v8.log "$wd"
+cd "$wd"
node-tick-processor > profile.txt
@@ -125,6 +125,7 @@
"/tmp/glob-test/quux",
"/tmp/glob-test/qwer",
"/tmp/glob-test/rewq",
+ "benchclean.sh",
"benchmark.sh",
"common.js",
"CONTRIBUTING.md",

0 comments on commit 367f9ec

Please sign in to comment.