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

module: significantly improve loader performance #26970

Closed
wants to merge 5 commits into from

Commits on Mar 31, 2019

  1. Configuration menu
    Copy the full SHA
    b5683e7 View commit details
    Browse the repository at this point in the history
  2. benchmark: improve module-loader benchmark

    Add more benchmark options to properly verify the gains.
    
    This makes sure the benchmark also tests requiring the same module
    again instead of only loading each module only once.
    BridgeAR committed Mar 31, 2019
    Configuration menu
    Copy the full SHA
    faa0518 View commit details
    Browse the repository at this point in the history
  3. module: inline try catch

    Moving `try / catch` into separate functions is not necessary
    anymore due to V8 optimizations.
    BridgeAR committed Mar 31, 2019
    Configuration menu
    Copy the full SHA
    50e2414 View commit details
    Browse the repository at this point in the history
  4. module: add path to the module object

    This adds the `path` property to the module object. It contains the
    current directory as path. That is necessary to add an extra caching
    layer.
    
    It also makes sure the `id` uses a default in case it's not set.
    Otherwise the `path.dirname(id)` command could fail.
    BridgeAR committed Mar 31, 2019
    Configuration menu
    Copy the full SHA
    538f745 View commit details
    Browse the repository at this point in the history
  5. module: add extra caching layer

    This adds an extra modules caching layer that operates on the parent's
    `path` property and the current require argument. That together can
    be used as unique identifier to speed up loading the same module more
    than once. It is a cache on top of the current modules cache.
    
    It has the nice feature that this cache does not only work in the same
    file but it works for the whole current directory. So if the same file
    is loaded in any other file from the same directory, it will also hit
    this cache instead of having to resolve the file again.
    
    To keep it backwards compatible with the old modules cache, it detects
    invalidation of that cache.
    BridgeAR committed Mar 31, 2019
    Configuration menu
    Copy the full SHA
    9137c56 View commit details
    Browse the repository at this point in the history