diff --git a/README.md b/README.md index 9580f69..3cf53de 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,16 @@ See https://github.com/zertosh/v8-compile-cache/tree/master/bench. _^ Includes the overhead of loading the cache itself._ +**CPU Instructions:** + +| Module | Without Cache | With Cache | +| ---------------- | ---------------:| ----------------:| +| `babel-core` | ` 1,052,229,095`| `797,511,448` | +| `yarn` | ` 777,718,754`| `545,279,558` | +| `yarn` (bundled) | ` 1,190,974,452`| `562,439,581` | + +_^ Includes the overhead of loading the cache itself._ + ## Acknowledgements * `FileSystemBlobStore` and `NativeCompileCache` are based on Atom's implementation of their v8 compile cache: diff --git a/bench/require-express.js b/bench/require-express.js new file mode 100755 index 0000000..eafd136 --- /dev/null +++ b/bench/require-express.js @@ -0,0 +1,9 @@ +#!/usr/bin/env node +'use strict'; + +const WITH_CACHE = true; + +require('./_measure.js')('require-express', WITH_CACHE, () => { + const express = require('express'); + const app = express(); +}); diff --git a/bench/run-perf-stat.sh b/bench/run-perf-stat.sh new file mode 100755 index 0000000..10b2575 --- /dev/null +++ b/bench/run-perf-stat.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# for i in {1..5}; do node bench/require-yarn.js; done + +# rm -rf "$TMPDIR/v8-compile-cache" + +THIS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +: ${NODE_BIN:=node} + +$NODE_BIN -p '`node ${process.versions.node}, v8 ${process.versions.v8}`' + +for f in $THIS_DIR/require-*.js; do + echo "Running "$(basename $f)"" + for i in {1..5}; do perf stat -e instructions -- $NODE_BIN $f; done +done diff --git a/package.json b/package.json index 87dd7b0..6587cea 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "devDependencies": { "babel-core": "6.23.1", "eslint": "^3.15.0", + "express": "^4.16.4", "flow-parser": "0.38.0", "rimraf": "^2.5.4", "rxjs": "5.2.0",