mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
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:
parent
b4fd1ad31c
commit
15734f5c4b
1 changed files with 2 additions and 0 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue