in reply to Re: Perl Threads and multi-core CPUs
in thread Perl Threads and multi-core CPUs
This is because they copy every data structure except the ones you mark as shared
Only if the data structures exist before the threads are spawned. So don't do that. Spawn your threads before you load or create your large data structures. It ain't rocket science.
And, as has been mentioned before, most forked perl processes do not benefit from COW much either:
And that's just a few of the apparently read-only operations that will cause COW to trigger. Doing anything non-readonly, like adding or deleting an element to a hash or array and you induce wholesale copying. Increment or decrement a variable. Modify it 'in-place' with s/// or tr or substr.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Perl Threads and multi-core CPUs
by perrin (Chancellor) on Sep 10, 2008 at 05:36 UTC | |
by BrowserUk (Patriarch) on Sep 10, 2008 at 06:34 UTC | |
by perrin (Chancellor) on Sep 10, 2008 at 12:10 UTC | |
by BrowserUk (Patriarch) on Sep 10, 2008 at 19:41 UTC |