diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-09-08 10:24:04 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-09-08 10:24:04 +0100 |
commit | 9a87bd09eea1d037e82e99f6ece528e39e7fe0e6 (patch) | |
tree | 687527f4f2be761e544a22f09e7bbd4ee0a51141 /hv.c | |
parent | ea25a9b2cf73948b1e8c5675de027e0ad13277bd (diff) | |
download | perl-9a87bd09eea1d037e82e99f6ece528e39e7fe0e6.tar.gz |
Remove offer_nice_chunk(), PL_nice_chunk and PL_nice_chunk_size.
These provided a non-public API for the hash and array code to donate free
memory direct to the SV head allocation routines, instead of returning it
to the malloc system with free().
I assume that on some older mallocs this could offer significant benefits.
However, my benchmarking on a modern malloc couldn't detect any significant
effect (positive or negative) on removing the code. Its (continued) presence,
however, has downsides
a: slightly more code complexity
b: slightly larger interpreter structure
c: in the steady state, if net creation of SVs is zero, 1 chunk of allocated
but unused memory will exist (per thread)
So I think it best to remove it.
Diffstat (limited to 'hv.c')
-rw-r--r-- | hv.c | 16 |
1 files changed, 2 insertions, 14 deletions
@@ -1105,13 +1105,7 @@ S_hsplit(pTHX_ HV *hv) if (SvOOK(hv)) { Copy(HvAUX(hv), &a[newsize * sizeof(HE*)], 1, struct xpvhv_aux); } - if (oldsize >= 64) { - offer_nice_chunk(HvARRAY(hv), - PERL_HV_ARRAY_ALLOC_BYTES(oldsize) - + (SvOOK(hv) ? sizeof(struct xpvhv_aux) : 0)); - } - else - Safefree(HvARRAY(hv)); + Safefree(HvARRAY(hv)); #endif PL_nomemok = FALSE; @@ -1270,13 +1264,7 @@ Perl_hv_ksplit(pTHX_ HV *hv, IV newmax) if (SvOOK(hv)) { Copy(HvAUX(hv), &a[newsize * sizeof(HE*)], 1, struct xpvhv_aux); } - if (oldsize >= 64) { - offer_nice_chunk(HvARRAY(hv), - PERL_HV_ARRAY_ALLOC_BYTES(oldsize) - + (SvOOK(hv) ? sizeof(struct xpvhv_aux) : 0)); - } - else - Safefree(HvARRAY(hv)); + Safefree(HvARRAY(hv)); #endif PL_nomemok = FALSE; Zero(&a[oldsize * sizeof(HE*)], (newsize-oldsize) * sizeof(HE*), char); /* zero 2nd half*/ |