[PR] Merge simple body/uri/rawbody rules into one shared per-l ine loop [spamassassin]
bigio (via GitHub) <[email protected]> Tue, 21 Jul 2026 15:42:50 -0000
| Newsgroups | gmane.mail.spam.spamassassin.devel |
|---|---|
| Message-ID | <[email protected]> |
bigio opened a new pull request, #33:
URL: https://github.com/apache/spamassassin/pull/33
do_body_tests()/do_uri_tests()/do_rawbody_tests() generated a separate "foreach my $l (@_) {...}" loop per active rule, so the same line/URI array was walked in full once per rule (thousands of active rules in a typical ruleset) on top of the regex-test cost that's unavoidable.
Add add_merged_line_tests(), which folds all "simple" rules (no "multiple" tflag, no regex capture template) for a given ruletype and priority into a single shared loop, using a per-rule "already matched" flag instead of the per-rule "last" each rule used to break its own loop with. Rules using "multiple"/maxhits or capture templates keep their own loop unchanged, since they mutate the shared $test_qr variable or need /g position tracking that doesn't compose with other rules sharing one iteration.
This diff needs to be verified with an email corpus to make sure rule score are correctly kept.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]