3 ms·
It's not the size, it's the work needed to decode and encode data. Node.js is really, really good at shunting I/O around - it's ideal for writing things like p
by simonw 16y ago
It's not the size, it's the work needed to decode and encode data.
Node.js is really, really good at shunting I/O around - it's ideal for writing things like proxies and file upload handlers. With ASCII, the bytes that come in are the bytes that go out again. If you're dealing with UTF-8 and unicode strings every time some data comes in you need to decode it as UTF-8, then pass the unicode string around within Node, then encode it back to bytes before you send it off again.
That makes a lot of sense for a web framework like Django (in fact it's what Django does) but Node is more of an I/O toolkit, so that performance overhead isn't welcome unless it's explicitly needed.
- pornel 16y agoModern CPUs are constrained by speed of memory, and amount of calculations you do on each byte doesn't matter that much. Node.js already takes the hit by copying memory to convert UTF-16 to ASCII.
- pmjordan 16y agoThe uses you mention sound like something for which you'd use byte buffers, not strings.