Open KSXGitHub opened 10 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
bd7002a
) 87.01% compared to head (aca2c2b
) 87.01%. Report is 4 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
group main pr
----- ---- --
tarball/download_dependency 1.01 6.8±0.43ms 641.9 KB/sec 1.00 6.7±0.19ms 648.4 KB/sec
Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
---|---|---|---|---|
pacquet@HEAD |
146.9 ± 8.6 | 132.7 | 163.9 | 1.10 ± 0.09 |
pacquet@main |
133.3 ± 8.1 | 121.4 | 145.7 | 1.00 |
Here are a few general rules of thumb I follow for I/O operations:
tokio::spawn_blocking
with a synchronous version. However, tasks should never directly use std::fs
as it blocks the worker thread. For minor file operations, tokio::fs
is the preferred choice.
String
s incurs a real performance hit. If String
s need to be shared between threads/tasks but aren't modified, consider using Arc<str>
.
Thanks @TmLev for the suggestion.
The benchmark proved that
spawn_blocking
does improve the performance, even if it's only slightly.