summaryrefslogtreecommitdiff
path: root/ext/Data
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-10-08 00:25:07 +0000
committerNicholas Clark <nick@ccl4.org>2006-10-08 00:25:07 +0000
commita4e0d2399ad31e76c4f1f1f5c7e44c6b5df4e6ae (patch)
tree24a4ad747703889080ef6704714e079c6bbdb3a9 /ext/Data
parent9fa5cce2ac5fe91228c7c54739f581c98f0738ef (diff)
downloadperl-a4e0d2399ad31e76c4f1f1f5c7e44c6b5df4e6ae.tar.gz
Document the growth policy, and Yves suggested a better arbitary
constant. (The original plan was add 80 if free space is less than 80, which wasn't a noticable improvement. Hence 40 was 80/2 for plan B) p4raw-id: //depot/perl@28964
Diffstat (limited to 'ext/Data')
-rw-r--r--ext/Data/Dumper/Dumper.xs7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/Data/Dumper/Dumper.xs b/ext/Data/Dumper/Dumper.xs
index dbdc2d6b16..0e60f6f7ee 100644
--- a/ext/Data/Dumper/Dumper.xs
+++ b/ext/Data/Dumper/Dumper.xs
@@ -274,9 +274,14 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv,
if (!val)
return 0;
- if (SvTYPE(retval) >= SVt_PV && (SvLEN(retval) - SvCUR(retval)) < 40) {
+ /* If the ouput buffer has less than some arbitary amount of space
+ remaining, then enlarge it. For the test case (25M of output),
+ *1.1 was slower, *2.0 was the same, so the first guess of 1.5 is
+ deemed to be good enough. */
+ if (SvTYPE(retval) >= SVt_PV && (SvLEN(retval) - SvCUR(retval)) < 42) {
sv_grow(retval, SvCUR(retval) * 1.5);
}
+
realtype = SvTYPE(val);
if (SvGMAGICAL(val))