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: optimize Buffer#toString() #2027

Merged
merged 1 commit into from
Jun 25, 2015

Commits on Jun 25, 2015

  1. buffer: optimize Buffer#toString()

    Break up Buffer#toString() into a fast and slow path.  The fast path
    optimizes for zero-length buffers and no-arg method invocation.
    
    The speedup for zero-length buffers is a satisfying 700%.  The no-arg
    toString() operation gets faster by about 13% for a one-byte buffer.
    
    This change exploits the fact that most Buffer#toString() calls are
    plain no-arg method calls.  Rewriting the method to take no arguments
    means a call doesn't go through an ArgumentsAdaptorTrampoline stack
    frame in the common case.
    
    PR-URL: nodejs#2027
    Reviewed-By: Brian White <mscdex@mscdex.net>
    Reviewed-By: Christian Tellnes <christian@tellnes.no>
    Reviewed-By: Daniel Cousens <email@dcousens.com>
    Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
    Reviewed-By: Trevor Norris <trev.norris@gmail.com>
    bnoordhuis committed Jun 25, 2015
    Configuration menu
    Copy the full SHA
    8350f3a View commit details
    Browse the repository at this point in the history