diff options
author | Nicholas Clark <nick@ccl4.org> | 2021-08-21 10:03:25 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2021-08-23 08:29:09 +0000 |
commit | 10b6fccfaddd6179d0a1f0a8bd9688d4829eb900 (patch) | |
tree | b5dc78e7e412f7fc942ddb58531c192f0ff2df8c /ext | |
parent | 009b864d9e6614ebbaed4f82c3bd6de967b53856 (diff) | |
download | perl-10b6fccfaddd6179d0a1f0a8bd9688d4829eb900.tar.gz |
Hash::Util::FieldHash fix_trigger can pre-size the hash before use.
This is only called by CLONE (and hence only matters for ithreads), but it's
an improvement, and small and self-contained.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Hash-Util-FieldHash/FieldHash.xs | 3 | ||||
-rw-r--r-- | ext/Hash-Util-FieldHash/lib/Hash/Util/FieldHash.pm | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/ext/Hash-Util-FieldHash/FieldHash.xs b/ext/Hash-Util-FieldHash/FieldHash.xs index 240d59f746..80ef639265 100644 --- a/ext/Hash-Util-FieldHash/FieldHash.xs +++ b/ext/Hash-Util-FieldHash/FieldHash.xs @@ -289,7 +289,8 @@ HUF_fix_trigger(pTHX_ SV *trigger, SV *new_id) { HV* new_tab = newHV(); HE* ent; SV* old_id = *av_fetch(cont, 0, 0); - hv_iterinit(field_tab); + I32 entries = hv_iterinit(field_tab); + hv_ksplit(new_tab, entries); while ((ent = hv_iternext(field_tab))) { SV* field_ref = HeVAL(ent); HV* field = (HV*)SvRV(field_ref); diff --git a/ext/Hash-Util-FieldHash/lib/Hash/Util/FieldHash.pm b/ext/Hash-Util-FieldHash/lib/Hash/Util/FieldHash.pm index ecd164b125..5fcbb4aad1 100644 --- a/ext/Hash-Util-FieldHash/lib/Hash/Util/FieldHash.pm +++ b/ext/Hash-Util-FieldHash/lib/Hash/Util/FieldHash.pm @@ -1,11 +1,10 @@ package Hash::Util::FieldHash; -use 5.009004; use strict; use warnings; use Scalar::Util qw( reftype); -our $VERSION = '1.22'; +our $VERSION = '1.23'; use Exporter 'import'; our %EXPORT_TAGS = ( |