summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2021-08-21 18:49:59 +0000
committerNicholas Clark <nick@ccl4.org>2021-08-23 08:29:09 +0000
commit5fe1e1c7d536af9e841701d7ad72536bda2b04e3 (patch)
tree657aee91f22fc5423b3076bed5a1e11363c73313 /perl.c
parent43231a2f47936854a0cf2d8f4d0f9a16c8d5eeb2 (diff)
downloadperl-5fe1e1c7d536af9e841701d7ad72536bda2b04e3.tar.gz
Comment about some subtleties in S_init_postdump_symbols().
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/perl.c b/perl.c
index 62dbe1aef2..be8f5a8e86 100644
--- a/perl.c
+++ b/perl.c
@@ -4624,6 +4624,17 @@ S_init_postdump_symbols(pTHX_ int argc, char **argv, char **env)
(void)strupr(old_var);
*s = '=';
#endif
+ /* It's tempting to think that this hv_exists/hv_store pair should
+ * be replaced with a single hv_fetch with the LVALUE flag true.
+ * However, hv has magic, and if you follow the code in hv_common
+ * then for LVALUE fetch it recurses once, whereas exists and
+ * store do not recurse. Hence internally there would be no
+ * difference in the complexity of the code run. Moreover, all
+ * calls pass through "is there magic?" special case code, which
+ * in turn has its own #ifdef ENV_IS_CASELESS special case special
+ * case. Hence this code shouldn't change, as doing so won't give
+ * any meaningful speedup, and might well add bugs. */
+
if (hv_exists(hv, old_var, nlen)) {
const char *name = savepvn(old_var, nlen);