if (!val)
return 0;
- if (SvTYPE(retval) >= SVt_PV && (SvLEN(retval) - SvCUR(retval)) < 40) {
- sv_grow(retval, SvCUR(retval) * 1.5);
+ /* 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) * 3 / 2);
}
+
realtype = SvTYPE(val);
if (SvGMAGICAL(val))
(*levelp)++;
ipad = sv_x(aTHX_ Nullsv, SvPVX_const(xpad), SvCUR(xpad), *levelp);
- if (realtype <= SVt_PVBM) { /* scalar ref */
+ if (
+#if PERL_VERSION < 9
+ realtype <= SVt_PVBM
+#else
+ realtype <= SVt_PVMG
+#endif
+ ) { /* scalar ref */
SV * const namesv = newSVpvn("${", 2);
sv_catpvn(namesv, name, namelen);
sv_catpvn(namesv, "}", 1);