Le mardi 11 décembre 2012 à 20:56, David Golden a écrit :
On Tue, Dec 11, 2012 at 9:10 AM, damien krotkine <dkrotkine@gmail.com (mailto:dkrotkine@gmail.com)> wrote:
The only drawback is performance : there is an additional indirection, and code dereferencing might be costly. The optimization of the route caching stops wher your route code starts, so it won't be optimized. You don't get performance hits ( or less, at least I think) with attributes.
I'm not sure it's clear cut. Right now, there is a before hook that runs for *every* route that has to do this:
* method call to get the coderef for the route * function call to retrieve attributes for coderef * logic on attributes returned
Hm you're right, I had not realized it'd be for *every* route. Indeed we need more benchmark here :) But I like the attribute style. If it can help in decision making, catalyst makes use of them as well, and it's rather elegant.
If only a fraction of routes require authentication, then that's a lot of extra overhead compared to wrapping only the subs that need it. And even if all routes require auth, the indirection is one call compared to two. The two calls might be cacheable, though, but even still, a single extra sub call only on routes that need it isn't too bad.
David
-- David Golden <xdg@xdg.me (mailto:xdg@xdg.me)> Take back your inbox! → http://www.bunchmail.com/ Twitter/IRC: @xdg _______________________________________________ dancer-users mailing list dancer-users@dancer.pm (mailto:dancer-users@dancer.pm) http://lists.preshweb.co.uk/mailman/listinfo/dancer-users