deno
deno copied to clipboard
perf(tokio): add improved runtime thread handling - multi cpu
- improve multi cpu architecture performance
- add improved thread runtime performance
-- note
This PR leverages multi-core CPUs and improves the spawn capabilities for operations. By default threads live for 10 seconds after idle which makes sense for re-using the same thread except for applications that can be ran once and exited - non http servers etc.
Thanks for the patch! Do you have some benchmark that demonstrates the improvement?
@ry you are welcome! I can get a benchmark this week. Need to make a minimal demo since the project is private, should be straight forward for the example. Thank you for the JS runtime using Rust!
@ry you are welcome! I can get a benchmark this week. Need to make a minimal demo since the project is private, should be straight forward for the example. Thank you for the JS runtime using Rust!
Busy week - made a little progress on the benchmarks will try to get it done soon. Feel free to take this into other hands if moving too slow!
@ry pardon the delay, I went ahead and attached benchmarks for the runtime changes. Thank you for the patience.
@j-mendez Thank you for the benchmarks. Although none of them are doing anything asynchrnous so it's unlikely that we are measuring spawn
/ spawn_blocking
performance here. A better benchmark would be Deno.writeFile
or Deno.readFile
which uses spawn_blocking
for file read/writes.
@j-mendez Thank you for the benchmarks. Although none of them are doing anything asynchrnous so it's unlikely that we are measuring
spawn
/spawn_blocking
performance here. A better benchmark would beDeno.writeFile
orDeno.readFile
which usesspawn_blocking
for file read/writes.
You are welcome, I appreciate the lead on the next steps. I am going to see if I can look into that since running the bench at root is a bit harder to track due to the amount of benches ran.
@j-mendez Try this one deno run -A --unstable cli/bench/write_file.js
. It tries to write small chunks to /dev/null
as fast as possible.
@j-mendez Try this one
deno run -A --unstable cli/bench/write_file.js
. It tries to write small chunks to/dev/null
as fast as possible.
I attached the logs of the before and after. I noticed afterwards my rust-analyzer
ran in between reason for the drastic differences on branch checkouts.
Ran the microbenchmarks again and i see no difference. I'd prefer to stay to the default unless there is a clear perf improvement. Thank you for the PR!