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

Speed up require(), phase 1 and 2 #1801

Merged
merged 2 commits into from
May 27, 2015

Commits on May 27, 2015

  1. lib: speed up require(), phase 1

    Replace calls to fs.statSync() with an internal variant that does not
    create Error or Stat objects that put strain on the garbage collector.
    
    A secondary benefit is that it improves start-up times in the debugger
    because it no longer emits thousands of exception debug events.
    
    PR-URL: nodejs#1801
    Reviewed-By: Trevor Norris <[email protected]>
    bnoordhuis committed May 27, 2015
    Configuration menu
    Copy the full SHA
    b14fd1a View commit details
    Browse the repository at this point in the history
  2. lib: speed up require(), phase 2

    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.
    
    [0] https://github.com/strongloop/loopback-sample-app
    
    PR-URL: nodejs#1801
    Reviewed-By: Trevor Norris <[email protected]>
    bnoordhuis committed May 27, 2015
    1 Configuration menu
    Copy the full SHA
    1bbf8d0 View commit details
    Browse the repository at this point in the history