diff options
author | David Mitchell <davem@iabyn.com> | 2010-10-31 17:01:10 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2010-11-01 16:38:31 +0000 |
commit | 51698cb360d5bba06e12496ef9c7bf82e3352b71 (patch) | |
tree | 98d362c2891820fa8fc1def26eaa824f33dd7ebd /perlvars.h | |
parent | 328552296d8d53b34dfe2dcb81fd7119bdc526f5 (diff) | |
download | perl-51698cb360d5bba06e12496ef9c7bf82e3352b71.tar.gz |
RT 75254: Slow GC after Scalar::Util::weaken
Freeing lots of weak RVs to the same object results in quadratic
search through the backrefs array. This is probably sufficiently rare
that its not worth the expense of replacing the array with a ptr table
(say); but in the meantime, this patch makes the code as tight as
possible, and adds a check for the sv being at element 0, so that
both types of linear create/destroy order are optimised (previously only
created last / deleted first order was quick). It's still slow for random
deletion order. The RT code, modified to give high-res timing for the
return from the sub, and with various types of destruct order, gives the
following timings:
LIFO FIFO random
before 0.05s 17.37s 17.28s
now 0.04s 0.04s 12.05s
Diffstat (limited to 'perlvars.h')
0 files changed, 0 insertions, 0 deletions