Skip to content

Commit

Permalink
Mention generics in "optimizing dependencies"
Browse files Browse the repository at this point in the history
Mention generics in "optimizing dependencies"
  • Loading branch information
Eekle committed Jan 27, 2024
1 parent 3f9df2b commit 953d293
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/unsorted/speed-vs-size.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ override the optimization level of dependencies. You can use that feature to
optimize all dependencies for size while keeping the top crate unoptimized and
debugger friendly.

Beware that generic code can sometimes be optimized alongside the crate where it
is instantiated, rather than the crate where it is defined. If you create an
instance of a generic struct in your application and find that it pulls in code
with a large footprint, it may be that increasing the optimisation level of the
relevant dependencies has no effect.

[`profile-overrides`]: https://doc.rust-lang.org/cargo/reference/profiles.html#overrides

Here's an example:
Expand Down

0 comments on commit 953d293

Please sign in to comment.