develooper Front page | perl.perl5.porters | Postings from September 2000

Speed up experiment for 5.7.*

Thread Next
Nick Ing-Simmons
September 3, 2000 06:53
Speed up experiment for 5.7.*
Message ID:

I am proposing to try and speed up scheme for 5.7.* - partly 
to test the concept for perl6.

Scheme is as follows: 

In hv.v always have 

   if (HeKEY(entry) != key && memNE(HeKEY(entry),key,len))

rather than just memNE().

Thus if address of string is same we avoid the string compare.

Then invent 

newSVpvn_share(char *s, STRLEN len, U32 hash)

Which creates a Sv_PVIVt with SvPVX being result of sharepvn()
and hash stored in the SvUVX. This is aking to what pp_method_named
does already, but with the extra twist of using the shared string.

These SVs will have SvREADONLY and SvFAKE set and use existing SvLEN == 0
scheme to avoid string being free'd.

The READONLY/FAKE does not seem to occur at present but is a bit of a bodge.
When that combination occurs with SvPVX sv_clear will unsharepvn() to 
drop the stringtable refcount.

Intial test will only use this for pp_method_named but if it works
then the other obvious thing to do is apply it to all constant strings
and in particular to the SVs returned from keys %hash - as most hashed
have shared keys.

Can anyone see a flaw in the basic idea ?

Nick Ing-Simmons

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