Bug 3685 - [review] uri and rawbody rules can exit earlier
Summary: [review] uri and rawbody rules can exit earlier
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Rules (show other bugs)
Version: SVN Trunk (Latest Devel Version)
Hardware: Other other
: P5 enhancement
Target Milestone: 3.0.0
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-14 12:55 UTC by Theo Van Dinter
Modified: 2004-08-14 14:30 UTC (History)
0 users



Attachment Type Modified Status Actions Submitter/CLA Status
adds a "last" to rawbody + uri foreach() loops on hit patch None Theo Van Dinter [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Theo Van Dinter 2004-08-14 12:55:09 UTC
I was just poking around the code and found at least URI and rawbody rules can exit earlier.  Right now, 
the RE is run against *all* URIs/paragraphs in a message, even if a hit has already occured (ie: there's a 
foreach(@_){} with no "last;" statement).

We did this for body rules in 3.0, we should do it for URI and rawbody as well.
Comment 1 Theo Van Dinter 2004-08-14 12:55:52 UTC
I'm breaking my own rule of "no more enhancements for 3.0", but I feel this is actually us not 
completing what we should have done before.
Comment 2 Theo Van Dinter 2004-08-14 12:59:27 UTC
Created attachment 2251 [details]
adds a "last" to rawbody + uri foreach() loops on hit
Comment 3 Theo Van Dinter 2004-08-14 13:02:47 UTC
ok, I just copied the 2 lines from the body section to rawbody and uri.  I checked the other test types: 
body already exits on a hit (previous comment), full is a single scalar RE against pristine_body, and 
header is a scalar RE against the appropriate header(s).  the eval tests do their own thing.

please review + vote. :)
Comment 4 Justin Mason 2004-08-14 13:04:18 UTC
+1
Comment 5 Daniel Quinlan 2004-08-14 16:10:45 UTC
Subject: Re:  rules can exit earlier

+0.5 benchmark on ham and spam, please :-)

Comment 6 Theo Van Dinter 2004-08-14 19:35:11 UTC
Subject: Re:  [review] uri and rawbody rules can exit earlier

On Sat, Aug 14, 2004 at 04:10:46PM -0700, bugzilla-daemon@bugzilla.spamassassin.org wrote:
> +0.5 benchmark on ham and spam, please :-)

I did a quick benchmark, just for you. :)

Ran against the same 5000 ham + 5000 spam pre and post patch.  Total time
pre-patch 11:17, total time post-patch 11:15, for a 0.3% speed increase.
Same results pre and post.

I figured there wouldn't be a big time win overall.  There are a total
of 66 rules, rawbody (30)/uri (36), versus the 511 body rules in 3.0,
so that was obviously a much bigger win.

Comment 7 Michael Parker 2004-08-14 22:23:31 UTC
+1
Comment 8 Theo Van Dinter 2004-08-14 22:30:19 UTC
committed.  r36405
Comment 9 Daniel Quinlan 2004-08-15 00:27:14 UTC
Subject: Re:  [review] uri and rawbody rules can exit earlier

For the record...

+1

although I suspect most of the improvement was just caching of the
files... I just wanted to make sure there wasn't some adverse effect
given where we are.  ;-)