rust/compiler/rustc_lexer/src
bors 2a9e0831d6 Auto merge of #91393 - Julian-Wollersberger:lexer_optimization, r=petrochenkov
Optimize `rustc_lexer`

The `cursor.first()` method in `rustc_lexer` now calls the `chars.next()` method instead of `chars.nth_char(0)`.

This allows LLVM to optimize the code better. The biggest win is that `eat_while()` is now fully inlined and generates better assembly. This improves the lexer's performance by 35% in a micro-benchmark I made (Lexing all 18MB of code in the compiler directory). But lexing is only a small part of the overall compilation time, so I don't know how significant it is.

Big thanks to criterion and `cargo asm`.
2021-12-03 13:20:14 +00:00
..
unescape Warn when an escaped newline skips multiple lines 2021-08-11 11:35:08 +02:00
cursor.rs Replace nth_char(0) with next() in cursor.first() 2021-12-01 19:14:10 +01:00
lib.rs Auto merge of #91393 - Julian-Wollersberger:lexer_optimization, r=petrochenkov 2021-12-03 13:20:14 +00:00
tests.rs
unescape.rs use matches!() macro in more places 2021-11-06 16:13:14 +01:00