in reply to Are Restricted/Locked Hashes a Failed Experiment?

I would say yes they are, just like perltie

Where as perltie problem is performance, the lock_keys problem is promotion, just what is it for?

I find this post very telling Re: Should we consider locked hashes a failed experiment? - nntp.perl.org

If this discussion somehow leads to a faster perltie for xs modules, that would be good :)

Maybe this sheds some light

#!/usr/bin/perl -- use strict; use warnings; use Benchmark 'cmpthese'; use Hash::Util(); use Tie::Hash::FixedKeys (); our %fudge= ( 1,1,3,3 ); our %judge = ( 1,1,3,3 ); our %budge = ( 1,1,3,3 ); our %mudge = ( 1,1,3,3 ); Hash::Util::lock_keys(%fudge); tie %budge, 'Tie::Hash::FixedKeys', keys %budge; cmpthese( -3, { 'lock' => '$fudge{1}++; eval{$fudge{r}++}; ', 'die' => '$judge{1}++; eval{$judge{r}++;die}; ', 'fix' => '$budge{1}++; eval{$budge{r}++;}; ', 'fatal' => '$mudge{{1,1}->{1}}++; eval{use warnings FATAL => qw(u +ninitialized); $mudge{{1,1}->{r}}++;}; ', 'olock' => '$fudge{1}++; ', 'odie' => '$judge{1}++; ', 'ofix' => '$budge{1}++; ', 'ofatal' => '$mudge{{1,1}->{1}}++; ', }); __END__
            Rate    fix  fatal   ofix   lock    die ofatal  olock   odie
fix       5127/s     --   -96%   -96%   -97%   -98%   -99%  -100%  -100%
fatal   114761/s  2138%     --    -5%   -31%   -46%   -76%   -97%   -97%
ofix    120289/s  2246%     5%     --   -28%   -43%   -75%   -97%   -97%
lock    167169/s  3161%    46%    39%     --   -21%   -65%   -96%   -96%
die     212804/s  4051%    85%    77%    27%     --   -55%   -94%   -95%
ofatal  477397/s  9211%   316%   297%   186%   124%     --   -88%   -90%
olock  3861974/s 75226%  3265%  3111%  2210%  1715%   709%     --   -15%
odie   4569982/s 89036%  3882%  3699%  2634%  2048%   857%    18%     --
  • Comment on Re: Are Restricted/Locked Hashes a Failed Experiment? (yes, like perltie, benchmark)
  • Download Code