-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updates readme with current information
bumps local-npm version fixes print-summary.py file adds print-summary funcation at the end of test.sh
- Loading branch information
1 parent
c216e7f
commit 1ddbfd1
Showing
5 changed files
with
160 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
language: node_js | ||
node_js: | ||
- "7" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,172 +1,158 @@ | ||
Test `local-npm` speed | ||
=== | ||
|
||
Compare the `npm install` times for [local-npm](https://github.com/nolanlawson/local-npm/) versus regular npm, using some popular JavaScript repos. | ||
# test-local-npm-speed | ||
|
||
> Compare the `npm install` times for [local-npm](https://github.com/local-npm/local-npm/) versus regular `npm`, using some popular JavaScript repos. | ||
<!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 --> | ||
|
||
- [test-local-npm-speed](#test-local-npm-speed) | ||
- [Summary](#summary) | ||
- [nolanlawson/tiny-queue](#nolanlawsontiny-queue) | ||
- [lodash/lodash](#lodashlodash) | ||
- [substack/node-browserify](#substacknode-browserify) | ||
- [strongloop/express](#strongloopexpress) | ||
- [facebook/react](#facebookreact) | ||
- [gulpjs/gulp](#gulpjsgulp) | ||
- [pouchdb/pouchdb](#pouchdbpouchdb) | ||
- [Full data](#full-data) | ||
- [nolanlawson/tiny-queue](#nolanlawsontiny-queue) | ||
- [local-npm](#local-npm) | ||
- [Regular npm](#regular-npm) | ||
- [lodash/lodash](#lodashlodash) | ||
- [local-npm](#local-npm) | ||
- [Regular npm](#regular-npm) | ||
- [substack/node-browserify](#substacknode-browserify) | ||
- [local-npm](#local-npm) | ||
- [Regular npm](#regular-npm) | ||
- [strongloop/express](#strongloopexpress) | ||
- [local-npm](#local-npm) | ||
- [Regular npm](#regular-npm) | ||
- [facebook/react](#facebookreact) | ||
- [local-npm](#local-npm) | ||
- [Regular npm](#regular-npm) | ||
- [gulpjs/gulp](#gulpjsgulp) | ||
- [local-npm](#local-npm) | ||
- [Regular npm](#regular-npm) | ||
- [pouchdb/pouchdb](#pouchdbpouchdb) | ||
- [local-npm](#local-npm) | ||
- [Regular npm](#regular-npm) | ||
- [Notes](#notes) | ||
- [Reproduce these results](#reproduce-these-results) | ||
|
||
<!-- /TOC --> | ||
|
||
The test was run on a MacBook Air, with node 5.3.0 and npm 3.3.12. I'm on a slow-ish public WiFi at a café in Brooklyn. | ||
|
||
I started off with a small repo of mine, `nolanlawson/tiny-queue`, then moved on to some popular libraries like `lodash/lodash` and `facebook/react`. In each case, I'm just cloning the code from Github and running `npm install`. | ||
|
||
**TLDR:** Regular npm is faster for the first `npm install`, but afterwards `local-npm` is always faster, even after `npm cache clear`. Sometimes it's even 2x or 3x faster (e.g. 1m15.752s vs 3m50.467s to install `facebook/react` the 2nd time). This is kind of the point of `local-npm`: it gets faster the more you run it, because it aggressively caches everything. | ||
|
||
Summary | ||
---- | ||
# Summary | ||
|
||
### nolanlawson/tiny-queue | ||
|
||
* 56.92% slower for first `npm install` | ||
* 5.46% faster for second `npm install` | ||
* 43.15% faster after `npm cache clear` | ||
|
||
* 45.69% slower for first `npm install` | ||
* 3.22% faster for second `npm install` | ||
* 16.99% faster after `npm cache clear` | ||
### lodash/lodash | ||
|
||
* 51.04% slower for first `npm install` | ||
* 61.32% faster for second `npm install` | ||
* 85.44% faster after `npm cache clear` | ||
|
||
### substack/node-browserify | ||
|
||
* 14.43% slower for first `npm install` | ||
* 39.12% faster for second `npm install` | ||
* 90.41% faster after `npm cache clear` | ||
|
||
### strongloop/express | ||
|
||
* 21.40% faster for first `npm install` | ||
* 81.01% faster for second `npm install` | ||
* 92.20% faster after `npm cache clear` | ||
|
||
### facebook/react | ||
|
||
* 14.41% faster for first `npm install` | ||
* 67.13% faster for second `npm install` | ||
* 74.65% faster after `npm cache clear` | ||
|
||
### gulpjs/gulp | ||
|
||
* 75.62% faster for first `npm install` | ||
* 61.89% faster for second `npm install` | ||
* 80.46% faster after `npm cache clear` | ||
|
||
### pouchdb/pouchdb | ||
|
||
* 6.53% slower for first `npm install` | ||
* 38.34% faster for second `npm install` | ||
* 26.73% faster after `npm cache clear` | ||
|
||
Full data | ||
---- | ||
|
||
### nolanlawson/tiny-queue | ||
|
||
#### local-npm | ||
|
||
* 1st npm install: 0m8.840s | ||
* 2nd npm install: 0m1.679s | ||
* After cache clean: 0m2.008s | ||
|
||
#### Regular npm | ||
|
||
* 1st npm install: 0m3.808s | ||
* 2nd npm install: 0m1.776s | ||
* After cache clean: 0m3.532s | ||
|
||
### lodash/lodash | ||
|
||
#### local-npm | ||
|
||
* 1st npm install: 5m49.502s | ||
* 2nd npm install: 0m51.192s | ||
* After cache clean: 0m50.634s | ||
|
||
#### Regular npm | ||
|
||
* 1st npm install: 2m51.100s | ||
* 2nd npm install: 2m12.354s | ||
* After cache clean: 5m47.880s | ||
|
||
* 34.26% slower for first `npm install` | ||
* 6.78% faster for second `npm install` | ||
* 2.75% slower after `npm cache clear` | ||
### substack/node-browserify | ||
|
||
#### local-npm | ||
|
||
* 1st npm install: 1m47.306s | ||
* 2nd npm install: 0m23.969s | ||
* After cache clean: 0m22.342s | ||
|
||
#### Regular npm | ||
|
||
* 1st npm install: 1m31.819s | ||
* 2nd npm install: 0m39.369s | ||
* After cache clean: 3m52.876s | ||
|
||
* 33.00% slower for first `npm install` | ||
* 5.64% faster for second `npm install` | ||
* 20.27% slower after `npm cache clear` | ||
### strongloop/express | ||
|
||
#### local-npm | ||
|
||
* 1st npm install: 1m17.844s | ||
* 2nd npm install: 0m12.225s | ||
* After cache clean: 0m13.667s | ||
|
||
#### Regular npm | ||
|
||
* 1st npm install: 1m39.033s | ||
* 2nd npm install: 1m4.360s | ||
* After cache clean: 2m55.139s | ||
|
||
* 29.44% slower for first `npm install` | ||
* 9.86% faster for second `npm install` | ||
* 15.16% faster after `npm cache clear` | ||
### facebook/react | ||
|
||
#### local-npm | ||
|
||
* 1st npm install: 2m56.140s | ||
* 2nd npm install: 1m15.752s | ||
* After cache clean: 1m24.086s | ||
|
||
#### Regular npm | ||
|
||
* 1st npm install: 3m25.784s | ||
* 2nd npm install: 3m50.467s | ||
* After cache clean: 5m31.755s | ||
|
||
* 26.71% slower for first `npm install` | ||
* 8.89% slower for second `npm install` | ||
* 2.76% faster after `npm cache clear` | ||
### gulpjs/gulp | ||
|
||
#### local-npm | ||
|
||
* 1st npm install: 0m51.744s | ||
* 2nd npm install: 0m41.765s | ||
* After cache clean: 0m47.815s | ||
|
||
#### Regular npm | ||
|
||
* 1st npm install: 3m32.214s | ||
* 2nd npm install: 1m49.591s | ||
* After cache clean: 4m4.641s | ||
|
||
* 10.40% slower for first `npm install` | ||
* 6.68% faster for second `npm install` | ||
* 12.54% slower after `npm cache clear` | ||
### pouchdb/pouchdb | ||
|
||
#### local-npm | ||
|
||
* 1st npm install: 7m31.151s | ||
* 2nd npm install: 4m7.253s | ||
* After cache clean: 5m2.884s | ||
|
||
#### Regular npm | ||
|
||
* 1st npm install: 7m1.702s | ||
* 2nd npm install: 6m40.994s | ||
* After cache clean: 6m53.363s | ||
|
||
Notes | ||
--- | ||
* 8.16% slower for first `npm install` | ||
* 6.13% faster for second `npm install` | ||
* 12.62% faster after `npm cache clear` | ||
|
||
# Full data | ||
|
||
# nolanlawson/tiny-queue | ||
## local-npm | ||
* 1st npm install: 0m2.392s | ||
* 2nd npm install: 0m1.263s | ||
* After cache clean: 0m2.447s | ||
## Regular npm | ||
* 1st npm install: 0m1.299s | ||
* 2nd npm install: 0m1.305s | ||
* After cache clean: 0m2.948s | ||
# lodash/lodash | ||
## local-npm | ||
* 1st npm install: 1m22.140s | ||
* 2nd npm install: 0m48.855s | ||
* After cache clean: 1m19.177s | ||
## Regular npm | ||
* 1st npm install: 0m53.995s | ||
* 2nd npm install: 0m52.407s | ||
* After cache clean: 1m17.000s | ||
# substack/node-browserify | ||
## local-npm | ||
* 1st npm install: 0m41.307s | ||
* 2nd npm install: 0m26.133s | ||
* After cache clean: 0m49.842s | ||
## Regular npm | ||
* 1st npm install: 0m27.677s | ||
* 2nd npm install: 0m27.695s | ||
* After cache clean: 0m39.738s | ||
# strongloop/express | ||
## local-npm | ||
* 1st npm install: 0m19.571s | ||
* 2nd npm install: 0m13.149s | ||
* After cache clean: 0m16.645s | ||
## Regular npm | ||
* 1st npm install: 0m13.810s | ||
* 2nd npm install: 0m14.587s | ||
* After cache clean: 0m19.619s | ||
# facebook/react | ||
## local-npm | ||
* 1st npm install: 2m30.568s | ||
* 2nd npm install: 1m54.844s | ||
* After cache clean: 2m39.366s | ||
## Regular npm | ||
* 1st npm install: 1m50.349s | ||
* 2nd npm install: 1m44.638s | ||
* After cache clean: 2m43.893s | ||
# gulpjs/gulp | ||
## local-npm | ||
* 1st npm install: 0m40.063s | ||
* 2nd npm install: 0m36.125s | ||
* After cache clean: 1m4.591s | ||
## Regular npm | ||
* 1st npm install: 0m35.895s | ||
* 2nd npm install: 0m38.711s | ||
* After cache clean: 0m56.494s | ||
# pouchdb/pouchdb | ||
## local-npm | ||
* 1st npm install: 2m37.697s | ||
* 2nd npm install: 2m2.765s | ||
* After cache clean: 2m40.102s | ||
## Regular npm | ||
* 1st npm install: 2m24.823s | ||
* 2nd npm install: 2m10.778s | ||
* After cache clean: 3m3.219s | ||
|
||
# Notes | ||
|
||
The test is a little unfair, because my `local-npm` has already downloaded all the metadata, but this is a typical use-case for `local-npm`. (It replicates the npm metadata on first run, which can take a few hours.) I did clear out the tarballs before the test, though. | ||
|
||
Also, repos tested later in the test may benefit from a slight boost, if they share any modules with a previous repo. But again, this is a typical use-case for `local-npm` – the more you use it, the more that common tarballs will be pre-cached. | ||
|
||
I find it interesting that `local-npm` is faster even after the second `npm install`, which is when npm's cache is supposed to kick in. This suggests that npm is not caching as aggressively as it could be. | ||
|
||
Reproduce these results | ||
--- | ||
# Reproduce these results | ||
|
||
First, `npm install -g local-npm && local-npm`. Then just clone this repo and run `npm test`. The python script can print a summary afterwards. | ||
|
||
**Warning:** the test will override your local `~/.npmrc` file! So you may want to do `npmrc -c testing && npmrc testing` beforehand. | ||
**Warning:** the test will override your local `~/.npmrc` file! So you may want to do `npmrc -c testing && npmrc testing` beforehand. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
{ | ||
"name": "test-local-npm-speed", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "sh test.sh" | ||
}, | ||
"keywords": [], | ||
"author": "Nolan Lawson <nolan@nolanlawson.com>", | ||
"dependencies": { | ||
"local-npm": "1.4.9" | ||
}, | ||
"license": "Apache-2" | ||
"name": "test-local-npm-speed", | ||
"version": "1.0.0", | ||
"description": "Compare the `npm install` times for [local-npm](https://github.com/local-npm/local-npm/) versus regular `npm`, using some popular JavaScript repos.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "sh test.sh" | ||
}, | ||
"keywords": [ | ||
"local-npm", | ||
"speed", | ||
"test" | ||
], | ||
"author": "Nolan Lawson <nolan@nolanlawson.com>", | ||
"contributors": [ | ||
"Gabriel J. Csapo <gabecsapo@gmail.com>" | ||
], | ||
"dependencies": { | ||
"local-npm": "^2.0.1" | ||
}, | ||
"license": "Apache-2" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters