結果、以下のように両者を使うアプローチで大きな速度差はないということがわかったのでメモ。
$ perl closure-vs-method.pl Rate method closure method 535/s -- -12% closure 609/s 14% -- $ cat closure-vs-method.pl use strict; use warnings; use Benchmark qw(cmpthese); my $COUNT = 1000; sub doit_closed { my $cb = shift; $cb->(); } sub doit_method { my $cb = shift; $cb->meth(); } cmpthese(-1, { 'closure' => sub { for my $i (1..$COUNT) { doit_closed(sub { $i; }); } }, 'method' => sub { for my $i (1..$COUNT) { doit_method(Holder->new($i)); } } }); package Holder; sub new { my ($class, $value) = @_; return bless { value => $value }, $class; } sub meth { my $self = shift; return $self->{value}; }