Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #933 +/- ##
==========================================
- Coverage 58.08% 54.41% -3.68%
==========================================
Files 42 45 +3
Lines 15513 16959 +1446
==========================================
+ Hits 9011 9228 +217
- Misses 6502 7731 +1229
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Mingun
left a comment
There was a problem hiding this comment.
that reading from static data should have very similar performance for sync and async.
async have some runtime costs to handle all the machinery and if data is static (i.e no I/O) it is expected that it would be slower than sync interface. async is not about increasing performance of an individual task, but about using less threads to process more I/O bound tasks.
Cargo.toml
Outdated
| serde_derive = { version = "1.0.206" } | ||
| serde-value = "0.7" | ||
| tokio = { version = "1.21", default-features = false, features = ["macros", "rt"] } | ||
| tokio = { version = "1.21", default-features = false, features = ["macros", "rt", "rt-multi-thread"] } |
There was a problem hiding this comment.
I do not like to include new features that required just for internal tests / benches. Move benchmark to the compare sub-project to avoid this. It also would be useful to benchmark other libraries that provides async interface if there are so.
There was a problem hiding this comment.
I changed to a current-thread runtime. As this in in dev-dependencies, is it fine that criterion still has an added feature flag? Otherwise I could also just call block_on myself but the measurement code of criterion takes async into account
There was a problem hiding this comment.
I changed to a current-thread runtime. As this in in dev-dependencies, is it fine that criterion still has an added feature flag?
Yes, that is fine. Actually, I was wrong about my initial comment. Because this is dev-dependencies, it was possible to add a new feature, but for testing purposes I think that single-thread runtime is enough anyway.
I still think, that it would be better to place this benchmark into compare project.
244f588 to
1fde3e4
Compare
I am fully aware that it is expected to be slower but without IO (e.g. Tokio's File implementation is extremely inefficient on Linux because it uses thread pools and not io_uring) I wanted to avoid factors outside of quick-xml's control. Also https://docs.rs/tokio/1.49.0/src/tokio/io/async_buf_read.rs.html#99-107 and https://doc.rust-lang.org/src/std/io/impls.rs.html#406-416 seems to be relatively similar in their implementation so I would expect the compiler to be able to mostly remove the async state machine overhead. There are likely several places where the compiler is not able to optimize properly but I would've expected a smaller overhead. My actual usage is significantly more complex. I also shortly looked at the async implementation in quick-xml but I couldn't find an obvious place to improve. |
|
So personally I would prefer the benchmark at the current location because I intend it as a comparison of the crates own implementations. The compare subcrate seems to be more for comparison between different crates |
It seems like the async implementation is much slower that the synchronous implementation. As a first start, add an benchmark to more easily compare them and be able to track improvements / regressions.
My actual usage does not read from static data but I would expect that reading from static data should have very similar performance for sync and async.