develooper Front page | perl.perl5.porters | Postings from April 2003

Re: COW in CORE and SvFAKE in older Perl

Thread Previous | Thread Next
Aaron Sherman
April 29, 2003 15:30
Re: COW in CORE and SvFAKE in older Perl
Message ID:
On Tue, 2003-04-29 at 16:12, Nicholas Clark wrote:
> On Tue, Apr 29, 2003 at 11:07:29AM -0400, Aaron Sherman wrote:
> > I came across this message:
> > 
> >
> I think that this message is more informative: :-)

Thanks, I'll take a look off-line on my way home from tonight

> The good news: I can't measure any slowdown
> The bad news: I can't measure any speedup

> > I'm in the middle of writing a module that I thought would address some
> > SpamAssassin performance problems (or at least provide me with the
> > platform to address them) by creating SvFAKE values based on a substring
> > of original string (a "shard" as I've been referring to it) without
> > allocating new memory and/or copying.
> Have you profiled spamassassin to death yet and addressed everything else
> that can be addressed by conventional means?

No, I have not. The rest of the SA crew have been doing that, though. My
problem was that I was making a certain class of change that required
touching a LOT of the message all over again several times (re-analyzing
the message in several "big-picture" ways), and I found that my code was
much more damaging to performance than I expected. What's more, SA has
some interesting efficiency tricks which are very useful, but result in
massive memory duplication (which is why a 250Kb message is by default
the largest that it will process, and why SA is a useless tool for most

> Can you take advantage of the same magic as lvalue substr already uses?
> Or does magic give you sufficient speed hit that you are not going to gain
> anything?
> I don't know the answers to the questions I snipped.

I'm re-coding with 'U' magic now, but still testing to see if it does
what I want. The docs aren't clear on exactly what one can expect to
gain from using 'U' magic and what the order of operations/expectations
is. I'll have more info by tomorrow, and hopefully a working module to
clean up, document, test against 4 or 5 versions of Perl and submit to

I'll check out the rest of your suggestions as well when I have a
chance. Thanks again for the wonderfully detailed reply!

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About