FAQ
Hi!

I rewite some code from Strings to Buffers with zero data copying (I
use slice). But the new code was 10 times slower! I Buffer slower than
String?

--
  Michael

--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/744386752.20140914225137%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Floby at Sep 15, 2014 at 4:27 pm
    Barrier crossing between JS and C++ is slow. Buffer is implemented by
    Node.js and therefore each call to .slice() is expensive because of that
    barrier crossing.
    I advise you measure and choose the best option for your use case.
    On Monday, 15 September 2014 02:52:36 UTC+2, Michael Monashev wrote:

    Hi!

    I rewite some code from Strings to Buffers with zero data copying (I
    use slice). But the new code was 10 times slower! I Buffer slower than
    String?

    --
    Michael
    --
    Job board: http://jobs.nodejs.org/
    New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
    Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
    ---
    You received this message because you are subscribed to the Google Groups "nodejs" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
    To post to this group, send email to nodejs@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/4704e569-ed9c-4e81-9b5b-1f8448e753aa%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Mscdex at Sep 15, 2014 at 4:49 pm

    On Sunday, September 14, 2014 8:52:36 PM UTC-4, Michael Monashev wrote:
    I rewite some code from Strings to Buffers with zero data copying (I
    use slice). But the new code was 10 times slower! I Buffer slower than
    String?
    It'd be helpful if you also posted the relevant code.

    --
    Job board: http://jobs.nodejs.org/
    New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
    Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
    ---
    You received this message because you are subscribed to the Google Groups "nodejs" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
    To post to this group, send email to nodejs@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/94dba8c4-3789-49d3-a988-915d219742c1%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Andrey at Sep 16, 2014 at 6:05 pm
    Strings are very optimized in v8, so just replacing hot path string with
    buffer does not always help - benchmark first, ideally at a very low level
    ( statistical profiler / dtrace / generated assembly / irhydra ). For
    example, if you do `content += chunk` in a loop you are likely not copying
    strings - internally v8 keeps "content" string as linked list of chunks.
    Because this is low at code generation path, if you try to emulate this
    linked list manually in "user space" you might get slower code
    On Monday, 15 September 2014 10:52:36 UTC+10, Michael Monashev wrote:

    Hi!

    I rewite some code from Strings to Buffers with zero data copying (I
    use slice). But the new code was 10 times slower! I Buffer slower than
    String?

    --
    Michael
    --
    Job board: http://jobs.nodejs.org/
    New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
    Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
    ---
    You received this message because you are subscribed to the Google Groups "nodejs" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscribe@googlegroups.com.
    To post to this group, send email to nodejs@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/9e2b35a7-a008-4264-a1e8-cc8ac095461b%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupnodejs @
categoriesnodejs
postedSep 15, '14 at 12:51a
activeSep 16, '14 at 6:05p
posts4
users4
websitenodejs.org
irc#node.js

People

Translate

site design / logo © 2022 Grokbase