Move tracing::warn
call in spawn_try_task
to separate function
#3581
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I ran
cargo-llvm-lines
, and over 1% of the LLVM code comes from calls tospawn_try_task
.Generic functions cause separate LLVM code generation for each unique combination of generic arguments (each implementation of
Future
for thetask
parameter in this case). Moving part of the function to a separate non-generic function will reduce the amount of code generation, which can help with compilation speed. https://nnethercote.github.io/perf-book/compile-times.html#llvm-irThe complexity of the output of the
tracing::warn
macro can be seen here by selecting "expand macros" under "tools": playground linkHere's the output of
cargo-llvm-lines
on this commit using dev profile andCARGO_PROFILE_DEV_LTO=fat
:lineslib-lto.zip
I will make similar improvements in Tokio