in reply to threads::shared seems to kill performance
The implementation essentially does a similar thing to tieing (except that it's implemented in XS rather than perl); so
is a bit likemy %hash : shared; ... $x = $hash{foo};
Note that each thread has its own copy of the 'tied' hash; accessing it causes a global lock to be set, then an entry from the 'real' hash is copied to that thread.sub threads::shared::FETCH { lock $Some:Global:lock_var; return $Some::Shared::Space::hash{$_[0]}; } my %hash; tie %hash, 'threads::shared'; ...
Dave.
|
|---|