At 14:47 +0100 9/8/03, Dave Mitchell wrote: >On Mon, Sep 08, 2003 at 03:06:32PM +0200, Elizabeth Mattijsen wrote: >> I'm only interested (probably my tunnel vision ;-) in saving memory, >> as that means saving memory multiple times over when using threads, > > plus making threads faster on startup. >Note that Config.sh declares the vars holding the big strings as 'unique', >so they don't get copied when new threads are created. Running a simple test with Benchmark::Thread::Size confirms this. However, it is not nearly as much as you would hope it would save ;-( Performing each test 10 times (ref) 10 100 normal 10 100 unique 10 100 # (ref) normal unique 0 2187 ± 2 +20 +20 1 2610 ±16 +37 ± 4 +30 ±14 2 2944 ±18 +62 ±18 +41 ±18 5 3912 ±18 +122 ±22 +71 ±20 10 5534 ±18 +221 ±26 +125 ±28 20 8774 ±30 +424 ±34 +236 ±30 50 18493 ±32 +1045 ±50 +540 ±66 100 34689 ±32 +2069 ±70 +1063 ±74 ==== normal ====================================================== our $var = 'abcdefghij' x 1000; ==== unique ====================================================== our $var : unique = 'abcdefghij' x 1000; ================================================================== LizThread Previous | Thread Next