Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip trying to substitute macros into lines that do not contain them #296

Merged

Commits on Jun 22, 2023

  1. 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).
    albertziegenhagel committed Jun 22, 2023
    Configuration menu
    Copy the full SHA
    325b821 View commit details
    Browse the repository at this point in the history