Commit ac26fbb
authored
Replace hot Tokenizer loop with a mathematical expression
This piece of code is very hot, executed thousands, possibly millions of times.
I found this when I benchmarked our custom sniffs. The replaceTabsInToken() method is consistently reported as one of the absolute hottest ones. I looked at the method and was wondering why this particular piece is a loop when it can be a mathematical expression. According to my micro-benchmark (only measuring the changed piece) it's about twice as fast now. This will probably not have much of an effect in a real-world scenario. Still I find it worth it.1 parent d2574b9 commit ac26fbb
1 file changed
+3
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
642 | 642 | | |
643 | 643 | | |
644 | 644 | | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | | - | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
660 | 648 | | |
661 | 649 | | |
662 | 650 | | |
| |||
0 commit comments