Commit 01c9323
committed
PSR12/OpenTag: improve performance
No functional changes at all, just improving performance of the sniff by changing the order of certain checks.
Some benchmarks for this change run using the Performance report (PR 3810):
Command: `phpcs -ps . --extensions=php --ignore=/vendor/ --report=performance --standard=psr12`
Output for the `PSR12.Files.OpenTag` sniff:
Result | PHPCS itself | Set of Projects A | Set of Projects B | Set of Projects C |
------ | ------------------ | ------------------ | ------------------ | ----------------- |
Nr of Files Scanned | 614 | 4115 | 25546 | 2250 |
Before | 0.077045 ( 2.3 %) | 0.982014 ( 1.9 %) | 3.267655 ( 2.1 %) | 0.179564 ( 2.1 %)
After | 0.000928 ( 0.0 %) | 0.013066 ( 0.0 %) | 0.091816 ( 0.1 %) | 0.109021 ( 1.3 %)
With what the sniff does, the impact is biggest for files/codebases which already comply with the expectations of this sniff.1 parent d8fe527 commit 01c9323
File tree
2 files changed
+17
-12
lines changed- src/Standards/PSR12/Sniffs/Files
2 files changed
+17
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
206 | 208 | | |
207 | 209 | | |
208 | 210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 47 | | |
54 | 48 | | |
55 | 49 | | |
56 | 50 | | |
57 | 51 | | |
58 | 52 | | |
59 | 53 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| |||
0 commit comments