Rollup merge of #56699 - nnethercote:SymbolIndex, r=oli-obk
Use a `newtype_index!` within `Symbol`. This shrinks `Option<Symbol>` from 8 bytes to 4 bytes, which shrinks `Token` from 24 bytes to 16 bytes. This reduces instruction counts by up to 1% across a range of benchmarks. r? @oli-obk
This commit is contained in:
commit
dadf7fcc2d
3 changed files with 46 additions and 22 deletions
|
@ -207,6 +207,10 @@ pub enum Token {
|
|||
Eof,
|
||||
}
|
||||
|
||||
// `Token` is used a lot. Make sure it doesn't unintentionally get bigger.
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
static_assert!(MEM_SIZE_OF_STATEMENT: mem::size_of::<Token>() == 16);
|
||||
|
||||
impl Token {
|
||||
pub fn interpolated(nt: Nonterminal) -> Token {
|
||||
Token::Interpolated(Lrc::new((nt, LazyTokenStream::new())))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue