Skip to content

Commit

Permalink
Hash::Util::FieldHash fix_trigger can pre-size the hash before use.
Browse files Browse the repository at this point in the history
This is only called by CLONE (and hence only matters for ithreads), but it's
an improvement, and small and self-contained.
  • Loading branch information
nwc10 committed Aug 23, 2021
1 parent 009b864 commit 10b6fcc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ext/Hash-Util-FieldHash/FieldHash.xs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions ext/Hash-Util-FieldHash/lib/Hash/Util/FieldHash.pm
Original file line number Diff line number Diff line change
@@ -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 = (
Expand Down

0 comments on commit 10b6fcc

Please sign in to comment.