Jonathan,
Unfortunately, the current object construction slowness will make
this a non-starter. e.g. On my powerbook it takes 25ms of CPU time
for Moose to construct a dead-simple object with a single accessor
and no inheritance.
Yes, this is a well known issue, and one I am currently working on
solving it.
A question though, is this benchmark including Class::MOP/Moose
compile time? Because that is something we cannot do too much about
at the moment, which means Moose is really only usable in persistent
environments like mod_perl/FastCGI/etc.
http://code2.0beta.co.uk/moose/svn/Moose/trunk/lib/Moose/Cookbook/
FAQ.pod mentions that immutable classes may eliminate, or at least
vastly improve, object construction performance, and implies this
will hopefully be done by the end of the year. Does this schedule
still sound reasonable?
There is currently an experimental branch of the immutable Moose
http://code2.0beta.co.uk/moose/svn/Moose/branches/Moose-immutable/
it requires this branch from Class-MOP as well
http://code2.0beta.co.uk/moose/svn/Class-MOP/branches/Class-MOP-
tranformations/
It is not yet finished, but the plan is to get it completely working
by the end of this month. Production worthiness will take a little
longer of course, probably close to that "end of the year" timeline.
Early benchmarks show an average performance boost of 400-500%, with
a upper ceiling of 1200% for really simple constructors and a bottom
of about 175% for very complex constructors. A lot of this is
dependent upon the complexity of your attributes, and I do my best to
make sure you only pay for what you actually use.
This branch also includes a speed up version of the type constraint
system as well, which shows a performance boost of around 400% from
previous versions. This also contributes to the speedup in object
construction as well.
In the meantime, does anyone have a recommendation for an alternate
class framework I can use that will make the eventual jump to Moose
as painless as possible?
Well, it all depends on what Moose features you use. A fair portion
of them are not available anywhere else on CPAN. One alternative,
which I use myself, is to downgrade to Moose 0.11 (and Class::MOP
0.30 or so). It is still a little slow, but much more manageable,
especially if you are still in the development phase where speed
really shouldn't be that important.
- Stevan