diff options
author | Eric Wong <e@80x24.org> | 2020-09-11 07:32:31 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2020-09-12 20:29:11 +0000 |
commit | d11feea98718f2abb109af4216a36bdbd21b7191 (patch) | |
tree | 1f6f83caf21d52f61524e935fa53dcbb6f789877 /lib/PublicInbox/Watch.pm | |
parent | 0a1e15ad863782650a36025b9d52a6e9de5eadf3 (diff) | |
download | public-inbox-d11feea98718f2abb109af4216a36bdbd21b7191.tar.gz |
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'.
Diffstat (limited to 'lib/PublicInbox/Watch.pm')
-rw-r--r-- | lib/PublicInbox/Watch.pm | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/Watch.pm b/lib/PublicInbox/Watch.pm index 0f41dff2..8bbce929 100644 --- a/lib/PublicInbox/Watch.pm +++ b/lib/PublicInbox/Watch.pm @@ -651,7 +651,7 @@ sub event_step { PublicInbox::Sigfd::sig_setmask($oldset); die $@ if $@; } - goto(&fs_scan_step) if $self->{mdre}; + fs_scan_step($self) if $self->{mdre}; } sub watch_imap_fetch_all ($$) { @@ -1066,7 +1066,7 @@ sub fs_scan_step { sub scan { my ($self, $op) = @_; push @{$self->{ops}}, $op; - goto &fs_scan_step; + fs_scan_step($self); } sub _importer_for { |