The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mojolicious::Plugin::FastHelpers - Faster helpers for your Mojolicious application

SYNOPSIS

Lite app

  use Mojolicious::Lite;
  plugin "FastHelpers";
  app->start;

DESCRIPTION

Mojolicious::Plugin::FastHelpers is a Mojolicious plugin which can speed up your helpers, by avoiding AUTOLOAD.

It does this by injecting some new classes into the inheritance tree of Mojolicious and Mojolicious::Controller.

Warning

This module must be considered EXPERIMENTAL. There might even be some security isseus, so use it with care.

It is not currently used in production anywhere I know of, and I'm not sure if I can endorce such usage.

This is strictly a (unproven) proof of concept.

Benchmarks

There is a benchmark test bundled with this distribution, if you want to run it yourself, but here is a quick overview:

  $ TEST_BENCHMARK=200000 prove -vl t/benchmark.t
  ok 1 - App::Normal 2.08688 wallclock secs ( 2.08 usr +  0.00 sys =  2.08 CPU) @ 96153.85/s (n=200000)
  ok 2 - Ctrl::Normal 0.654221 wallclock secs ( 0.65 usr +  0.00 sys =  0.65 CPU) @ 307692.31/s (n=200000)
  ok 3 - App::FastHelpers 1.62765 wallclock secs ( 1.62 usr + -0.01 sys =  1.61 CPU) @ 124223.60/s (n=200000)
  ok 4 - Ctrl::FastHelpers 0.131942 wallclock secs ( 0.13 usr +  0.00 sys =  0.13 CPU) @ 1538461.54/s (n=200000)
  ok 5 - App::FastHelpers (1.61s) is not slower than App::Normal (2.08s)
  ok 6 - Ctrl::FastHelpers (0.13s) is not slower than Ctrl::Normal (0.65s)

                         Rate App::Normal App::FastHelpers Ctrl::Normal Ctrl::FastHelpers
  App::Normal         96154/s          --             -23%         -69%              -94%
  App::FastHelpers   124224/s         29%               --         -60%              -92%
  Ctrl::Normal       307692/s        220%             148%           --              -80%
  Ctrl::FastHelpers 1538462/s       1500%            1138%         400%                --

METHODS

register

Will create new classes for your application and "controller_class" in Mojolicious, and monkey patch in all the helpers.

AUTHOR

Jan Henning Thorsen

COPYRIGHT AND LICENSE

Copyright (C) 2018, Jan Henning Thorsen

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.

SEE ALSO

Mojolicious