| hi isaac, thanks for responding, it's nice of you to acknowledge it as a bug, and say you're working on it. > First of all, writing bug reports to Hacker News is usually a bit like complaining about the government at a bus stop. just a little note on this one, i've made clear in my original writing this is not hate and i sent an email to substack, and ryan to some others i know. i guess i will send you an email next time as well. not filing as a bug: you are right, i should have done that. Buffer<->string conversion is WAY too expensive in Node: yes it is, hope you can make this way better, because we don't want to hit cpu each time we pull data from a e.g. database. writing it to hackernews/stackoverflow: it's because i'm asking for solutions outside of nodejs domain, varnish,nginx or any other way this issue can be worked around. i'm sure you understand. and this was quite helpful as we're now deploying a few varnish and nginx servers to mitigate this problem. |
Of course, poking a bit further showed that converting a 16MB string to a buffer actually is quite expensive. You can avoid this by using buffers directly when you're serving files (or better yet, just pipe a fs.ReadStream directly into the response, so it'll stream it as it reads from disk, and buffer as little as possible.)