Closed (fixed)
Project:
Spam
Version:
6.x-1.x-dev
Component:
Bayesian Filter
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
29 Dec 2010 at 21:21 UTC
Updated:
13 Jan 2011 at 02:00 UTC
Jump to comment: Most recent file
As I was reviewing the token generation function, I noticed 3 things that are very easy optimizations and quite so:
1. There is one regex that used 'i' and a few lines below the entire buffer is converted to lower case
2. the HTTP[S], FTP... protocols where tested before the lower case, there is certainly no reason to not check for HTTP:// as well (or even Http://)
3. The variable_get() in the loop would always return the same value and could be optimized with a variable which got to be faster
Thank you.
Alexis
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | spam-6.x-baysian_optimization.patch | 2.24 KB | AlexisWilke |
| spam-6.x-baysian_optimization.patch | 2.24 KB | AlexisWilke |
Comments
Comment #1
gnassar commentedAll makes sense.
Quick fix on a typo, line 14 of the patch file:
+ $sanitized = drupal_strtolower($tring);
should be
+ $sanitized = drupal_strtolower($string);
(good reason to run with E_NOTICE enabled, right?) ;)
Comment #2
AlexisWilke commentedYes... 8-)
There is a fixed patch, just in case.
Comment #3
jeremy commentedLooks good.
BTW: Any improvements/bug fixes made to the 6.x spam_filter_bayesian.module are likely candidates for patches against the 7.x bayesian.module which I intend to have the 7.x spam module depend on. http://drupal.org/project/dail
Comment #4
gnassar commentedAs much as I may hate to say it (and trust me, I *hate* to say it), that probably means we need to start the 7.x-dev branch ASAP. (Between that, and D7 launching in nine days...)
Comment #5
jeremy commentedI think we should hold off on a 7.x branch until we have another stable/tested 6.x release. It doesn't make much sense to branch an unstable and rapidly changing code base imo. The bayesian.module I was referring to already exists for 7.x at the above link, and should simplify the code in the spam_filter_bayesian module when ported to 7.x.
Comment #6
AlexisWilke commentedJeremy,
How could they have a Bayesian filter and not the spam filter? Is there a special implementation of the Bayesian functionality in that dail module? Just wondering... 8-)
Note that you can hijack this issue and set it to the dail project if you want to.
(and possibly the fix at line 118 and around?)
Thank you.
Alexis
Comment #7
jeremy commented> Is there a special implementation of the Bayesian functionality
It's a generic bayesian implementation to allow it to be used by other modules, not just the spam module. There will still need to be a spam_filter_bayesian module to hook it into the spam api.
Comment #8
gnassar commentedWell, I can't say I object to that. I was hoping to wait for D7 until another stable release. (Which I think we're getting close to. I just submitted a patch for the last really-old-and-untouched bug fix. Exciting!) :)
But if we're going to do that -- would you object for perhaps just taking that D6 stable release and making the D7 port a straight port of that, with no major changes (like moving Bayesian support to another module)? We're going to have our hands full as it is with the port, I think. I'd rather just get what we have as stable here over to D7, and then start making big changes.
Alexis: commit link?
Comment #9
AlexisWilke commentedhttp://drupal.org/cvs?commit=471294
http://drupal.org/cvs?commit=471272 (for #1009234: Notices on line 118 of Bayesian filter)
http://drupal.org/cvs?commit=471244 (for #1009234: Notices on line 118 of Bayesian filter)
I guess I should update the CHANGELOG.txt too... 8-P
Here: http://drupal.org/cvs?commit=471358