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

buffer: improve creation performance #6893

Closed
wants to merge 1 commit into from
Closed

buffer: improve creation performance #6893

wants to merge 1 commit into from

Commits on Jun 3, 2016

  1. buffer: Improve creation performance.

    Improves performance of allocating unsafe buffers, creating buffers from
    an existing ArrayBuffer and creating .slice(...) from existing Buffer by
    avoiding deoptimizing change of prototype after Uint8Array allocation
    in favor of ES6 native subclassing.
    
    This is done through an internal ES6 class that extends Uint8Array and
    is used for allocations, but the regular Buffer function is exposed, so
    calling Buffer(...) with or without `new` continues to work as usual
    and prototype chains are also preserved.
    
    Performance wins for .slice are +120% (2.2x), and, consequently, for
    unsafe allocations up to +95% (1.9x) for small buffers, and for safe
    allocations (zero-filled) up to +30% (1.3x).
    RReverser committed Jun 3, 2016
    Configuration menu
    Copy the full SHA
    14c9ce5 View commit details
    Browse the repository at this point in the history