perl-unicode

RE: utf8::SWASHNEW

2005-05-02 14:37:39
One of the things we gathered from our profiling was that more of the SWASH*
activity in our apps was happening around regexes. We took a closer look
and, for the regexes that could never have unicode values (e.g. for internal
URL checking), we just scoped them and did a "use bytes" within that scope.
It helped, but not to the degree that we thought it would.

Turns out the act of profiling the code actually exacerbated the frequency
of these SWASH* functions. Instrumenting suspect functions outside of
profiling demonstrated that.

-Chris

-----Original Message-----
From: Rafael Garcia-Suarez [mailto:rgarciasuarez(_at_)mandriva(_dot_)com]
Sent: Friday, April 29, 2005 8:58 AM
To: perl-unicode(_at_)perl(_dot_)org
Subject: Re: utf8::SWASHNEW

Eric Cholet wrote in perl.unicode :
I just did a profiling on one of my programs, and it turns out it
spends most of its time in utf8::SWASHNEW. In second place is one of my
own functions, and in third place comes utf8::SWASHGET. What do
SWASHNEW and SWASHGET do ? (in layman's terms-- I browsed the source
but it gave me a headache). Is this a price to pay when using Perl
unicode strings?

They're used to load and initialise the swatchs, ie. internal hashes
that contain unicode properties (sets of unicode chars, e.g.
alphabetics, etc).

So, they're typically called rarely. Can you post an example of code
that reproduces the problem ?

--
The sensation of a very small and at the same time extremely heavy object
produced a disagreeable impression of repugnance and fear.
    -- Borges

<Prev in Thread] Current Thread [Next in Thread>