X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FCookbook%2FBasics%2FRecipe7.pod;h=b3fabe0e7d4cce1798d8478b46a1b7a3df889233;hb=ccea63ce44db05da6bbc1a51a136ead4c275f8e4;hp=4b2047d7fd113cfdaa04d2b442246d1fd25160d3;hpb=2840a3b25fac3ab606e2053ce9ef30b39687270d;p=gitmo%2FMoose.git diff --git a/lib/Moose/Cookbook/Basics/Recipe7.pod b/lib/Moose/Cookbook/Basics/Recipe7.pod index 4b2047d..b3fabe0 100644 --- a/lib/Moose/Cookbook/Basics/Recipe7.pod +++ b/lib/Moose/Cookbook/Basics/Recipe7.pod @@ -17,33 +17,21 @@ Moose::Cookbook::Basics::Recipe7 - Making Moose fast with immutable =head1 DESCRIPTION -The Moose metaclass API provides a method C. At a -high level, this calling this method does two things to your -class. One, it makes it faster. In particular, object construction and -accessors are effectively "inlined" in your class, and no longer go -through the meta-object system. +The Moose metaclass API provides a C method. Calling +this method does two things to your class. First, it makes it +faster. In particular, object construction and destruction are +effectively "inlined" in your class, and no longer invokes the meta +API. -Second, you can no longer make changes via the metaclass API such as -adding attributes. In practice, this won't be a problem, as you don't -usually need to do this at runtime after first loading the class. - -=head2 Immutabilization and C - -If you override C in your class, then the immutabilization code -will not be able to provide an optimized constructor for your -class. Instead, consider providing a C method. You can -probably do the same thing in a C method. - -Alternately, if you really need to provide a different C, you -can also provide your own immutabilization method. - -Discussing this is beyond the scope of this recipe, however. +Second, you can no longer make changes via the metaclass API, such as +adding attributes. In practice, this won't be a problem, as you rarely +need to do this after first loading the class. =head1 CONCLUSION We strongly recommend you make your classes immutable. It makes your -code much faster, basically for free. This will be especially -noticeable when creating many objects or calling accessors frequently. +code much faster, with a small compile-time cost. This will be +especially noticeable when creating many object. =head1 AUTHOR