about summary refs log tree commit diff
path: root/src/liballoc_jemalloc/lib.rs
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2016-09-16 15:46:40 +1000
committerNicholas Nethercote <nnethercote@mozilla.com>2016-09-16 15:46:40 +1000
commit8075d546069e9fc850beb846747c43e9ee55e175 (patch)
tree479e43e7b591c2a8e82fc8b2f12dffc60a81f7e1 /src/liballoc_jemalloc/lib.rs
parentf81f4964d26683c9a47ff4516a97ab84095d7bc9 (diff)
downloadrust-8075d546069e9fc850beb846747c43e9ee55e175.tar.gz
rust-8075d546069e9fc850beb846747c43e9ee55e175.zip
Optimize the parser's last token handling.
The parser currently makes a heap copy of the last token in four cases:
identifiers, paths, doc comments, and commas. The identifier and
interpolation cases are unused, and for doc comments and commas we only
need to record their presence, not their value.

This commit consolidates the last token handling and avoids the
unnecessary copies by replacing `last_token`, `last_token_eof`, and
`last_token_interpolated` with a new field `last_token_kind`. This
simplifies the parser slightly and speeds up parsing on some files by
3--4%.
Diffstat (limited to 'src/liballoc_jemalloc/lib.rs')
0 files changed, 0 insertions, 0 deletions