Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: reduce size of Id and add IdRef
This reduces the size of `Id` from 24 bytes to 16 bytes on 64-bit systems, and from 12 bytes to 8 bytes in 32-bit systems. It also adds an `IdRef` type that we can use instead of a `&Id`, this avoids a double indirection (`&str` vs `&String`). In `trustfall-rustdoc-adapter` we see a [7% perf improvement][1] when using `&IdRef` instead of `&Id`. Sadly, AFAIK, there is no way to safely coerce `Id(Box<str>)` to `&IdRef(str)` so we need to do an unsafe `std::mem::transmute(&str) -> &IdRef`. [1]: obi1kenobi/trustfall-rustdoc-adapter#423 (comment)
- Loading branch information