On Wed, Aug 20, 2003 at 10:14:04PM +0200, Leopold Toetsch wrote:

> The main time consuming task is just constructing the exception object. 
> Real objects might be faster here, but all the runtime construction of 
> such complex objects suffer of the same problem: we don't have constant 
> and cached strings (meaning currently: each hash key is a new string) 
> and we don't have means to create constant shared PMCs at runtime.

As of (I think 5.8) Perl 5 started using shared hash keys - all hash keys
are shared [and reference counted - this is perl 5 :-)], so that

1: if the same string is ever used a second time memory is saved
2: the string compare routine for hash key lookup first checks to see if
   the pointers are the same. If so, it can skip the memcmp()

I believe that Nick I-S said that this hash key sharing accelerated his large
work TK app by about 2%. Benchmarking Perl 5 usefully is hard - I don't
yet have any good benchmark for Perl 5.

(It's number 3 on my post Paris TODO. Only our washing machine has now
broken, so number 2 is reasserting itself - "laundry". At this rate I'll
never get to number 4 - CV)

Nicholas Clark

Reply via email to