chore(parser): code comment for cold trampoline function (#3467)

Add a comment to explain the "cold trampoline function" used in lexer.
This commit is contained in:
overlookmotel 2024-05-30 01:11:00 +01:00 committed by GitHub
parent b4fd1ad31c
commit 15734f5c4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -308,6 +308,8 @@ impl<'a> Lexer<'a> {
}
/// Call a closure while hinting to compiler that this branch is rarely taken.
/// "Cold trampoline function", suggested in:
/// <https://users.rust-lang.org/t/is-cold-the-only-reliable-way-to-hint-to-branch-predictor/106509/2>
#[cold]
pub fn cold_branch<F: FnOnce() -> T, T>(f: F) -> T {
f()