Commit a95e24e
committed
perf: cache lexers per file extension in syntax highlighting
Previously, the syntaxHighlight function called lexers.Match() for every
line in a diff.
This change introduces a thread-safe cache that stores lexers by file
extension.
Assisted-By: cagent1 parent 7f09e89 commit a95e24e
1 file changed
Lines changed: 25 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
| |||
127 | 134 | | |
128 | 135 | | |
129 | 136 | | |
130 | | - | |
131 | | - | |
132 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
133 | 155 | | |
134 | | - | |
135 | 156 | | |
136 | 157 | | |
137 | 158 | | |
| |||
0 commit comments