Commit 325b821
committed
skip trying to substitute macros into lines that do not contain them
Currently, we try to substitute all macros into all lines by calling `subn` on the compiled regex, which results in an unmodified line if the line did not contain the macro at all. This call to `subn` is still quite expensive (runtime-wise).
To spare the cost, we now first check whether the line actually contains the macro text and skip the substitution check otherwise.
Please note that a line containing the macro text does not necessarily mean that a substitution will take place, since the simple containment is less strict than the regex (which checks that the macro is an actual token separated from the sounding context, as in `FOO` being in `FOO_BAR` but it should not be substituted).1 parent 1f54125 commit 325b821
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2234 | 2234 | | |
2235 | 2235 | | |
2236 | 2236 | | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
2237 | 2241 | | |
2238 | 2242 | | |
2239 | 2243 | | |
| |||
0 commit comments