Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

Commit

Permalink
perf: zoomzoom. Even more concurrency!
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Oct 13, 2017
1 parent 2d29efb commit db9c2e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
17 changes: 6 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,12 @@ class Installer {
if (dep.dev && this.config.config.production) { return }
const depPath = dep.path(this.prefix)
// Process children first, then extract this child
return BB.resolve()
.then(() => {
if (dep !== this.tree) {
// Don't try to extract the root
return extract.child(dep.name, dep, depPath, this.config)
}
})
.then(next)
.then(() => {
dep !== this.tree && this.pkgCount++
})
return BB.join(
!dep.isRoot && extract.child(
dep.name, dep, depPath, this.config
).then(() => { this.pkgCount++ }),
next()
)
}, {concurrency: 50, Promise: BB})
}

Expand Down
5 changes: 1 addition & 4 deletions lib/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const BB = require('bluebird')

const log = require('npmlog')
const pacote = require('pacote')
const rimraf = BB.promisify(require('rimraf'))

module.exports = (args, cb) => {
const parsed = typeof args === 'string' ? JSON.parse(args) : args
Expand All @@ -13,7 +12,5 @@ module.exports = (args, cb) => {
const opts = parsed[2]
opts.log = log
log.level = opts.loglevel
return rimraf(extractTo, {ignore: 'node_modules'}).then(() => {
return pacote.extract(spec, extractTo, opts)
}).nodeify(cb)
return BB.resolve(pacote.extract(spec, extractTo, opts)).nodeify(cb)
}

0 comments on commit db9c2e0

Please sign in to comment.