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 [email protected]. To post to this group, send email to [email protected]. 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.
