Skip to content

Speed up require(), phase 1 and 2

Replace calls to fs.statSync() with an internal variant that does not create Error or Stat objects that put strain on the garbage collector.

Replace calls to fs.readFileSync() with an internal variant that does not create Error objects on failure and is a bit speedier in general.

A secondary benefit is that it improves start-up times in the debugger because it no longer emits thousands of exception debug events.

On a medium-sized application[0], this commit and its predecessor reduce start-up times from about 1.5s to 0.5s and reduce the number of start-up exceptions from ~6100 to 32, half of them internal to the application.

CI: https://jenkins-iojs.nodesource.com/view/iojs/job/iojs+any-pr+multi/712/

R=@trevnorris?

Merge request reports

Loading