This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Storable is inefficient retreiving large hashes [PATCH]
authorTim Bunce <Tim.Bunce@pobox.com>
Thu, 21 Mar 2002 21:18:05 +0000 (21:18 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Thu, 21 Mar 2002 22:50:19 +0000 (22:50 +0000)
Message-ID: <20020321211805.E25276@dansat.data-plan.com>

p4raw-id: //depot/perl@15402

ext/Storable/Storable.xs

index 6e1dec9..847ec1f 100644 (file)
@@ -4223,6 +4223,7 @@ static SV *retrieve_hash(stcxt_t *cxt, char *cname)
        SEEN(hv, cname);                /* Will return if table not allocated properly */
        if (len == 0)
                return (SV *) hv;       /* No data follow if table empty */
+       hv_ksplit(hv, len);             /* pre-extend hash to save multiple splits */
 
        /*
         * Now get each key/value pair in turn...
@@ -4357,6 +4358,7 @@ static SV *old_retrieve_hash(stcxt_t *cxt, char *cname)
        SEEN(hv, 0);                    /* Will return if table not allocated properly */
        if (len == 0)
                return (SV *) hv;       /* No data follow if table empty */
+       hv_ksplit(hv, len);             /* pre-extend hash to save multiple splits */
 
        /*
         * Now get each key/value pair in turn...