On 24 Oct 2012, at 05:35, Toby Corkindale wrote:
> I was just wondering.. should we be adding Moose's make_immutable call
> to the end of these classes?
> ie. __PACKAGE__->meta->make_immutable;

This makes things faster if you construct lots of them (and also makes things a 
bit safer, as they can't be changed), at the cost of a bit of startup time.

Generally Catalyst components are only initialised once (i.e. they're scoped to 
the lifetime of the app), so there is no speed benefit to immutable in this 
case (actually, it's probably a startup speed reduction), but I still tend to 
use it for the safety…

So it's entirely optional, in classes which implement ACCEPT_CONTEXT (and so 
are constructed once per request), you will see a speed benefit from doing it, 
but this is the less unusual case.. 


List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to