summaryrefslogtreecommitdiff
path: root/dist/Data-Dumper
diff options
context:
space:
mode:
authorSteffen Mueller <smueller@cpan.org>2012-08-02 20:24:40 +0200
committerSteffen Mueller <smueller@cpan.org>2012-08-02 20:24:40 +0200
commitbdf6ae426d6ae070fc7ae8b962dfd48388954b16 (patch)
tree1c562c1ddce8ba296e5af2eeea02b73049aa26d8 /dist/Data-Dumper
parentd424882cc3537598b5c65fc8a4426bf49da5d903 (diff)
downloadperl-bdf6ae426d6ae070fc7ae8b962dfd48388954b16.tar.gz
Data::Dumper: Comment on previous optimization
The optimization in the previous commit to Data::Dumper (sparse seen hash) is not complete: It is so far only applied to non-RV SVs. This also means that it's safe not to check for weak-refs. Applying the optimization to RVs should be possible, but is not as easy (I think).
Diffstat (limited to 'dist/Data-Dumper')
-rw-r--r--dist/Data-Dumper/Dumper.xs4
1 files changed, 3 insertions, 1 deletions
diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs
index b382000c23..71b34ca2bb 100644
--- a/dist/Data-Dumper/Dumper.xs
+++ b/dist/Data-Dumper/Dumper.xs
@@ -888,7 +888,9 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv,
* (IOW, the user does not expect it to contain everything
* after the dump, then only store in seen hash if the SV
* ref count is larger than 1. If it's 1, then we know that
- * there is no other reference, duh. This is an optimization. */
+ * there is no other reference, duh. This is an optimization.
+ * Note that we'd have to check for weak-refs, too, but this is
+ * already the branch for non-refs only. */
else if (val != &PL_sv_undef && (!use_sparse_seen_hash || SvREFCNT(val) > 1)) {
SV * const namesv = newSVpvn("\\", 1);
sv_catpvn(namesv, name, namelen);