2 ms·
The interchange into v8 is indeed an issue, see another comment: https://news.ycombinator.com/item?id=22745941 https://news.ycombinator.com/item?id=22745941. >
by zbjornson 7y ago
The interchange into v8 is indeed an issue, see another comment: https://news.ycombinator.com/item?id=22745941 https://news.ycombinator.com/item?id=22745941.
> JSON parse is CPU-blocking, so if you get a large object, your server cannot handle any other web request until it finishes parsing
Well, your CPU core is busy on one request or another, so I don't understand why this is an issue as long as you're guarding against maliciously large bodies. Blocking I/O is different because your core is partially idle while other hardware is doing async work. Using Node.js' cluster module lets you keep more cores busy. Chunking CPU-limited work increases total CPU time and memory required. (This is a pet peeve of mine and a hill I'm willing to die on :-) .)
- marknadal 7y agoI think that is a good hill to die on, tho I would rather prioritize UX (browser not freezing) and server responsiveness. Ideally we'd have no CPU chunking & good UX, but if we have to choose one, which would you sacrifice?