about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
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/rustllvm/RustWrapper.cpp
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/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions