WARNING: This is a little big technical. :)

Funny thing, nested helpers actually have the potential to be a lot faster 
than normal helpers. You may be aware that helpers use AUTOLOAD, and are 
therefor quite a bit slower than normal method calls. Here's a little 
benchmark i did recently.

    https://gist.github.com/anonymous/0de87d1408f5e98707a1

As you can see, currently nested helpers basically cost two normal helper 
calls. Getting it that low actually took quite a bit of optimizing already. 
But now we do have the option of turning all nested helper calls into 
normal method calls with a patch like this.

   https://gist.github.com/anonymous/231abecbb6e09e5fb3f6

Changing our benchmark results to this.

    https://gist.github.com/anonymous/f93e4b96e0cf0082c1ef

So you could actually be using nested helpers as an optimization if you're 
using a lot of helpers. Only the first helper call (->foo) would use 
AUTOLOAD, the rest would be plain old method calls.

    my $foo = $c->foo;
    $foo->bar;
    $foo->baz;

Of course there's a downside to all of this too... the patch generates 
anonymous classes on demand, which may leak if you instantiate 
Mojolicious::Renderer objects dynamically and destroy them again while 
using nested helpers.

Thoughts?

--
sebastian

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to