From: Dave Mitchell <davem@fdisolutions.com>
Date: Wed, 19 May 2004 20:17:55 +0000 (+0000)
Subject: [perl #29637] Thread creation time is hypersensitive
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=14cade97ead1fce5346533c9ffae161becee82db;p=p5sagit%2Fp5-mst-13.2.git

[perl #29637] Thread creation time is hypersensitive

Due to a logic error, the dup ptr table sometimes wans't being
grown, leading to extremely slow cloning.

p4raw-id: //depot/perl@22830
---

diff --git a/sv.c b/sv.c
index f4c1cbe..4be4a7f 100644
--- a/sv.c
+++ b/sv.c
@@ -10400,11 +10400,11 @@ Perl_ptr_table_store(pTHX_ PTR_TBL_t *tbl, void *oldv, void *newv)
      * hash values e.g. if they grow faster in the most significant
      * bits */
     UV hash = PTR2UV(oldv);
-    bool i = 1;
+    bool empty = 1;
 
     assert(tbl);
     otblent = &tbl->tbl_ary[hash & tbl->tbl_max];
-    for (tblent = *otblent; tblent; i=0, tblent = tblent->next) {
+    for (tblent = *otblent; tblent; empty=0, tblent = tblent->next) {
 	if (tblent->oldval == oldv) {
 	    tblent->newval = newv;
 	    return;
@@ -10416,7 +10416,7 @@ Perl_ptr_table_store(pTHX_ PTR_TBL_t *tbl, void *oldv, void *newv)
     tblent->next = *otblent;
     *otblent = tblent;
     tbl->tbl_items++;
-    if (i && tbl->tbl_items > tbl->tbl_max)
+    if (!empty && tbl->tbl_items > tbl->tbl_max)
 	ptr_table_split(tbl);
 }