Skip to content

Instantly share code, notes, and snippets.

Created August 10, 2014 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/6b66860c9ee252d83ef7 to your computer and use it in GitHub Desktop.
Save anonymous/6b66860c9ee252d83ef7 to your computer and use it in GitHub Desktop.
$ perl -Ilib -MTime::HiRes=time -Mojo -E 'sub Mojolicious::Controller::bar { "works!" }; my $c = app->build_controller; my $before = time; $c->bar for 1 .. 100000; say time - $before'
0.0173139572143555
$ perl -Ilib -MTime::HiRes=time -Mojo -E 'helper bar => sub { "works!" }; my $c = app->build_controller; my $before = time; $c->bar for 1 .. 100000; say time - $before'
0.838340044021606
$ perl -Ilib -MTime::HiRes=time -Mojo -E 'helper bar => sub { "works!" }; helper foo => sub { shift }; my $c = app->build_controller; my $before = time; $c->foo->bar for 1 .. 100000; say time - $before'
1.64256691932678
$ perl -Ilib -MTime::HiRes=time -Mojo -E 'helper "foo.bar" => sub { "works!" }; my $c = app->build_controller; my $before = time; $c->foo->bar for 1 .. 100000; say time - $before'
2.33334112167358
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment