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

node: improve GetActiveRequests performance #3375

Closed
wants to merge 1 commit into from

Commits on Oct 21, 2015

  1. node: improve GetActiveRequests performance

    v8 is faster at setting object properties in JS than C++. Even when it
    requires calling into JS from native code. Make
    process._getActiveRequests() faster by doing this when populating the
    array containing request objects.
    
    Simple benchmark:
    
        for (let i = 0; i < 22; i++)
          fs.open(__filename, 'r', function() { });
        let t = process.hrtime();
        for (let i = 0; i < 1e6; i++)
          process._getActiveRequests();
        t = process.hrtime(t);
        console.log((t[0] * 1e9 + t[1]) / 1e6);
    
    Results between the two:
    
        Previous:  4406 ns/op
        Patched:    690 ns/op     5.4x faster
    trevnorris committed Oct 21, 2015
    Configuration menu
    Copy the full SHA
    d1dd435 View commit details
    Browse the repository at this point in the history