Hi,
I'm new to perl-threads but have/want to use them for a very time-consuming problem. The script uses a large hash-ref with data the threads should work on. The hash just holds the data to work with but nothing is changed. Because I ran into memory probs when not sharing the hash I use the shared_clone() to share it and pass it to the different threads. What I experience now is that compared to the non-shared-option the performance drops to ~50%.
My first guess was that shared_clone somehow locks the shared variable as soon as one of the threads starts reading it because it's not declared read-only. But the source does not look like it.
Can someone explain the loss of performance? Should/could/do I have to declare everything read-only to overcome this?
Cheers,
lowry
Perl v5.8.8
threads::shared v1.36
OS: Ubuntu 4.2.4