about summary refs log tree commit homepage
path: root/script
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-03-21 23:07:26 +0000
committerEric Wong <e@80x24.org>2023-03-25 09:37:48 +0000
commitd00087bcdf3a4c2411ecdf75b4f7ee583db530fb (patch)
tree092723bc50a32272eae50e13871b74d953a14a0e /script
parent87a8527cb3e09b88f224b8ba0aad28cb8ec8eba8 (diff)
downloadpublic-inbox-d00087bcdf3a4c2411ecdf75b4f7ee583db530fb.tar.gz
This allows us to avoid repeatedly using memory-intensive
anonymous subs in CodeSearchIdx where the callback is assigned
frequently.  Anonymous subs are known to leak memory in old
Perls (e.g. 5.16.3 in enterprise distros) and still expensive in
newer Perls.  So favor the (\&subroutine, @args) form which
allows us to eliminate anonymous subs going forward.

Only CodeSearchIdx takes advantage of the new API at the moment,
since it's the biggest repeat user of post-loop callback
changes.

Getting rid of the subroutine and relying on a global `our'
variable also has two advantages:

1) Perl warnings can detect typos at compile-time, whereas the
   (now gone) method could only detect errors at run-time.

2) `our' variable assignment can be `local'-ized to a scope
Diffstat (limited to 'script')
0 files changed, 0 insertions, 0 deletions