From d11feea98718f2abb109af4216a36bdbd21b7191 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 11 Sep 2020 07:32:31 +0000 Subject: treewide: avoid `goto &NAME' for tail recursion While Perl implements tail recursion via `goto' which allows avoiding warnings on deep recursion. It doesn't (as of 5.28) optimize the speed of such dispatches, though it may reduce ephemeral memory usage. Make the code less alien to hackers coming from other languages by using normal subroutine dispatch. It's actually slightly faster in micro benchmarks due to the complexity of `goto &NAME'. --- lib/PublicInbox/View.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/PublicInbox/View.pm') diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 3055da20..1d5119cd 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -386,7 +386,7 @@ sub next_in_queue ($$) { sub stream_thread_i { # PublicInbox::WwwStream::getline callback my ($ctx, $eml) = @_; - goto &thread_eml_entry if $eml; # tail recursion + return thread_eml_entry($ctx, $eml) if $eml; return unless exists($ctx->{skel}); my $ghost_ok = $ctx->{nr}++; while (1) { -- cgit v1.2.3-24-ge0c7