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
st
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
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: