googlefonts / googlefonts/fontations
Consistently use #[inline] in font-types
- Dominant language
- Rust
- Stars
- 826
- Forks
- 75
- Avg merge
- 22h 33m
- Merged PRs (30d)
- 75
Description
This attribute is poorly documented and inconsistently used, but potentially important.
For some more information, see https://github.com/rust-lang/hashbrown/pull/119#issuecomment-537539046.
The TL;DR is that `#[inline]` has two tasks: *within* a crate, it functions as a hint. Between crate boundaries, though, it is required in order for inlining to be possible at all.
This last point is particularly important in the `font-types` crate; it contains lots of small methods, which are really only called from external crates. In many cases, the code produced by inlining these functions is not going to be much larger than the code required to setup and execute a function call.
Based on this, I suspect that the majority of the small functions in font-types should be marked `#[inline]`; and this should definitely be true of functions like the `get` methods on `BigEndian`.
The downside of this is that each crate that uses font-types will end up with a separate copy of these functions. I believe that these should ultimately be deduplicated, but it will minorly impact compile times.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.