concurrency-benchmarks
concurrency-benchmarks copied to clipboard
Use a better algorithm in async jsws using streams
Here there is an example to implement the async web server in JS. https://nodejs.org/en/knowledge/advanced/streams/how-to-use-fs-create-read-stream/
Currently, the server works this way with promises only:
file: aaaAAAAaaaAAaaaa
res: --------------------bbbBBBBbbbBBbbbb
But, it would be better this way with steam:
file: aaaAAAAaaaAAaaaa
res: ---bbbBBBBbbbBBbbbb
The same idea can be applied to Rust, for example.
I tried this but on benchmarks, the req/second goes down with this