Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add express.js to the bench & provide CPU instructions #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions bench/require-express.js
Original file line number Diff line number Diff line change
@@ -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();
});
15 changes: 15 additions & 0 deletions bench/run-perf-stat.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down