It's not for HTTP, but for TCP, where the cost of that slice call even 10,000 times a second adds up to between 2.53ms to 27ms per second depending on the hardware.
On Friday, April 20, 2012 5:50:02 PM UTC+2, Tim Caswell wrote: > > > It's a way of thinking: do things in the most direct way possible with > a minimum of red tape. > > Minimum, yes, but no less. > > Making this a public, supported API is not without cost either. Just > need to prove that it's worth the cost and Isaac will happily work with you. > > Keep in mind that a stock node server can handle ~20,000 http > requests/second on a desktop machine. This is creating many, many objects, > closures, and other js level instances per request. Adding a single object > in the request handler makes little difference on the performance. Is > Buffer.prototype.slice was doing a memcopy of the data, then I would say > this is a significant cost. But since slice is a "cheap" operation, it's > usually not significant. > > If you're doing something that needs to happen on the order of 500,000 > times a second, then, yes, every object allocation matters. > > >