https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5876





--- Comment #11 from Justin Mason <[EMAIL PROTECTED]>  2008-04-08 07:20:19 PST 
---
I don't think there's a need to use File::Spec for that btw.

(In reply to comment #10)
> There are some other things that could be done to make this more memory
> efficient
> 
> perhaps use preset variables, never pass arguments as a hash to got hit
> 
> $self->got_hit(q#__BLAH_BLAH#,"BODY: ",ruletype=>"body");
> 
> would become
> 
> $self->got_hit(q#__REPTO_OVERQUOTE#,$prepend2desc,$body);

unfortunately this is a public API :( we could define a per-rule wrapper for
got_hit() though, for our code to use, which does this:

sub _got_body_hit { $_[0]->got_hit($_[1], "BODY: ",ruletype=>"body"); }

if that will save memory...

> Doing some testing this this shows a bit of memory recovery.   I just changed
> the body/head rules to constants and got back about 32k of ram.  I'm thinking
> perl is just storing lots of copied of the string "body" and "ruletype" in
> memory.  I'm not sure how it tried to internally optimize this. 

bizarre.  I was certain that was stored as 1 string internally.

> I wonder if it
> would be any faster if stored as a hash of qrs for the head and one line body
> stuff ?  Maybe you have already tried that though.

yes -- it's slower.  it may be more memory efficient, but I doubt the speed hit
will be worth it.

> Something like this is already done with the _eval tests
> 
> sub _eval_tests_type11_pri0_set1 {     
>  my ($self, @extraevalargs) = @_;      
> my $scoresptr = $self->{conf}->{scores};     
>  my $prepend2desc = q#BODY: #;      
> my $rulename;    
>   my $result;
> 
> f($scoresptr->{q#__HTML_LENGTH_1024_1536#}){$rulename=q#__HTML_LENGTH_1024_1536#;$self->{test_log_msgs}=();$self->{current_rule_name}=$rulename;$self->register_plugin_eval_glue(q#html_range#);eval{$result=$self->html_range
> (@extraevalargs ,q#length#, q#1024#, q#1536#
> );};if($@){$self->handle_eval_rule_errors($rulename);}if($result){$self->got_hit($rulename,$prepend2desc,ruletype=>"eval",value=>$result);
> }}
> ...

I don't quite get what you mean here...


-- 
Configure bugmail: 
https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to