There are ways to improve the caching used in Class::MOP - I can see if
$work will allow Stevan (author of Class::MOP and Moose) and I to work on
some details.

One thing I know that he and nothingmuch have been working on in Moose is
the ability to declare a class "closed" which will allow for Moose to cache
all the lookups at compiletime. I'm pretty sure there isn't something
similar for Class::MOP right now, but there may be able to be something
added that will allow that.

Of course, this is a major hit for compiletime which affects the testsuite's
running time quite dramatically. It will also be a pretty big runtime hit
for pure CGI scripts using CGI::Application. Using this under some
persistent environment (modperl or FCGI) will obviously negate that hit.

Rob

On 7/2/06, Mark Stosberg <[EMAIL PROTECTED]> wrote:

Ricardo SIGNES wrote:
> Did anyone (Mark?) look at the performance hit that Class::MOP will
cause?
> I've only taken a quick look, but it looks like the total user time to
run test
> suite goes up nearly 50% with this patch.

I hadn't done that, but it's certainly worth doing.  I did just a few
tests now, and found something on the order of a 10 to 25% increase.

> I'm assuming that a more hook-laden class will suffer even
more.  Benchmarks?

Not necessarily. It depends on whether the time is mostly in the
module-load time, or the method call time. Looking at the code, I see
some caching in the actual method call, so I suspect the module load time.

Still, the performance hit is enough for me to want to revert the patch.
It was interesting to learn about how this will work in Perl6, but
considering this drawback, I can wait for the Perl6 port to actually
apply the knowledge!

Thanks for your attentive to this.

I'll report our results back to the Class::MOP author.


There are ways to improve the caching used in Class::MOP - I can see if
$work will allow Stevan (author of Class::MOP and Moose) and I to work on
some details.

One thing I know that he and nothingmuch have been working on in Moose is
the ability to declare a class "closed" which will allow for Moose to cache
all the lookups at compiletime. I'm pretty sure there isn't something
similar for Class::MOP right now, but there may be able to be something
added that will allow that.

Of course, this is a major hit for compiletime which affects the testsuite's
running time quite dramatically. It will also be a pretty big runtime hit
for pure CGI scripts using CGI::Application. Using this under some
persistent environment (modperl or FCGI) will obviously negate that hit.

Rob

Reply via email to