Skip to content

Instantly share code, notes, and snippets.

Created August 10, 2014 16:24
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/d3e326c2d7fdd3626709 to your computer and use it in GitHub Desktop.
Save anonymous/d3e326c2d7fdd3626709 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'
1.97438716888428
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment