Thursday, March 25, 2010

Moose 1.00 is released

With help from Florian Ragwitz and all the rest of the Moose contributors, I just uploaded Moose 1.00 and Class::MOP 1.00 to the CPAN! And I am proud to say that over the last eight months or so, I have barely contributed more then a handful of lines of code to the project. This is not to say that I have abandoned it, but that it has now moved beyond me and is truly a community driven and developed project. And to that I raise my glass and say ...


Of course this doesn't mean anything more then 0.99 meant, I declared Moose 0.18 to be stable and ready to use almost 3 years ago, but reaching this release is still a milestone if only in that it will make it easier for some people convince their bosses to let them use Moose :)



Monday, February 1, 2010

On Frameworks ...

So I was reading zby's latest blog post on frameworks and libraries. On some level I agree with him that often times frameworks are basically just codified "convention", but I really don't see this as a bad thing, and here is why.

As I see it, the purpose of a library is to provide generic re-usable code that can be used in many different contexts. The purpose of a framework is to provide a set of guidelines/conventions/best-practices which a developer can then build upon, therefore avoiding the need to set those guidelines/dictate those conventions/determine those best practices themselves.

Some frameworks are more opinionated and complex (RoR, Catalyst, etc) and push/force you into their way of thinking, the benefit being that they also provide you with lots of building blocks that often times are zero-conf. While others (Dancer, Web::Simple, Mojolicious::Lite, etc) are more focused and purposefully simple, they leave many problems unsolved therefore allowing more freedom for the developer. Each of these approaches has merit and neither is truly superior in all contexts, which brings me to Plack and why I think this explosion of "frameworks" is a really good thing.

The ubiquity of Plack means that all these frameworks can be (fairly) easily used within the same application (or set of applications). It should (eventually) be very easy to have your Catalyst application running next to your Dancer application, running next to your WebNano application, all sharing the same session data, user information, etc. through Plack::Middleware components and mounted under a single Plack::App::URLMap and controlled easily using plackup.

Monday, January 25, 2010

Perl Oasis Slides

So I finally found some time this weekend to annotate my slides from OPW and get them uploaded to the interweb. The theme of the talk was two fold. First was that we all stand on top of the shoulders of those who came before us and that Open Source is a great context in which to do that, both when building on top of computer science concepts and when borrowing lessons learned from other language communities. The second half the talk was about my recent experiments using Plack (which is the Perl Web Server, in case you hadn't heard), Bread::Board, Path::Router and Moose, which I combined together as an experiment I call OX.

Thursday, January 21, 2010

Plack - The Perl Web Server

Wow, in less then a week it seems that Plack has climbed to number seven in Google search results for Perl Web Server. It is only a matter of time before the hivemind that is Google realizes what we already know, that Plack is *the* Perl Web Server for the new millennium!

Monday, January 18, 2010

Perl Oasis 2010

So this weekend I went down to the Perl Oasis (a.k.a - Orlando Perl Workshop, or OPW for short), which is a small one day conference run by Chris Prather and his wife Jamie. I had missed it last year, but I heard so many good reviews of it I decided that this year I couldn't miss it, and I am really glad I didn't because I had a really great time.

There were lots of great people, great talks and great conversation. Some highlights include miyagawa's Plack talk (Plack really should be the top search result for "Perl Web Server"), Lucas Oman gave a really interesting talk about trying to implement Roles in PHP, the always entertaining Matt Trout gave a talk in the form of an epic poem and many more.

I find that I really enjoy the small and short conferences, they are usually on a weekend (less work juggling to do) and everything is a group activity enjoyed by all (much easier to coordinate activities when you don't have 300+ attendees). This conference, along with the always fun Pittsburgh Perl Workshop are now both on my "can't miss" list.

Friday, September 4, 2009

Re: Re: Re: Moose Or No Moose

This has been a crazy week here in Moose-land as you might have read. I would like to attempt to sum this all up so that we can all move on and get back to programming (which is sooooooo much more fun then blogging).

Adam Kennedy responded to all this in his recent use.perl post, and then later came into the #moose IRC channel to discuss. In that post I think that he did an excellent job of answering the "Should Padre use Moose" question. His conclusion seemed to be "Not Yet" which I can respect given his well thought out reasons. I was also happy to see that Adam felt Moose had the "air of inevitability" about it, and he felt it was only a matter of time till the Moose community solved our startup time and memory efficiency issues.

For the record, I was never actually suggesting that Padre should immediately be re-written in Moose, but more that Padre and Moose might benefit from one another, and would those benefits perhaps outweigh the costs. For Adam (and I assume the rest of the Padre team) the answer was "Not Yet", that the costs were too high and that benefits not compelling enough for them.

Then this morning I arrived at my desk to see Daisuke Maki had posted his 2 cents about this debate. Two lines in Daisuke's post jumped out at me. The first was this one:
I'd really like them [the Moose develoers] to make a more thought-out response, and act like you actually care about the parties involved that have a slightly different view than yours
And the second was:
That will make my life easier. I can point people to the Moose roadmap or whatever and say, "look, they care. they /will/ address your concerns. let's just install Moose in your system for now, yeah?" and go on hacking with Moose.
So while I don't have any official roapmap yet, I will say that "we are working on it" and "we do care". If nothing more, this recent debate has served to light a fire under the Moose development team and forced us to take a closer look at ourselves. It is a challenge and one that we are ready to take on.

The first step is to admit that you have a problem.

So last night (after a challenge from Adam on IRC) Jesse (doy) Luehrs added memory usage stats to Shawn (Sartak) Moore's original script which produced this data and then Cory (gphat) Watson used his Chart::Clicker module, which is written in Moose ;) to produce this graph:

The purple line is startup time and the yellow line is memory usage. (As I pointed out before, that nice downward drop at the very end there is a direct result of the Japan Perl Associations sponsorship of Goro Fuji).

The second step is to do something about it.

A big part of the memory and CPU hit is from the meta-layer. These are all the objects that Moose has to create for your class, and then all the code Moose compiles and evals to make sure things are fast at runtime. This is largely a one-time (compile time) cost and if you never call the "meta" method on your Moose class then you never use it again. We currently have two projects going on to help reduce or even eliminate some of these costs.

A recent post by fREW Schmidt announced that he is currently working to refactor the Moose test suite in such a way that the meta-level tests are optional. This is to help make way for Matt Trout's proposed "Antlers" project, which aims to "compile" Moose classes such that the meta-layer (the part that consumes most of the memory and takes so much time at startup) is not loaded or used unless you actually specifically request it by calling the "meta" method itself.

This idea has been kicking around the Moose team's heads for a while, in fact it is an evolution/mutation of Yuval Kogman's MooseX::Compile module. When Yuval wrote his version over a year and a half ago, Moose did not have the proper features internally and so the project was shelved. Now we feel that Moose is ready, and with fREW's test suite refactoring, it should only be a matter of tuits before this can become a reality.

The second is a combination of Goro Fuji's work and some XS-ification that Yuval Kogman, Florian (rafl) Ragwitz and a few other Moose hackers have been doing. The aim of this is to eliminate much of the need to do the code evaling for accessor and constructor generation by moving them to XS. Since we don't want you to pay for any more features then your using, Moose currently will compile only as much accessor and constructor code as you need and eval it into existence (which gets expensive). It is the hope that by moving that code to XS we can eliminate the speed penalty of un-used features and therefore not need to custom compile anymore.

The third step is to recruit new cult members.

Actually I am not sure if that is the 3rd step or not, but it sounds good to me. So if you love Moose and have some spare tuits lying around, please come and help pick some low hanging fruits and make this a reality.

Wednesday, September 2, 2009

Moose Startup Time over Time

I actually owe marcus an apology.

You were correct in that Moose startup time has not gotten significantly faster since 0.01. After our exchange Sartak decided to actually take a look and see. So he wrote this script, which produced this data, which jhannah then promptly turned into this graph (reproduced below).

It seems that since the 0.15 release we have mostly stayed within the 0.2 to 0.3 second range. It is interesting to look at the Changelogs for both Moose and Class::MOP you can actually see the feature additions or refactorings that correspond with the peaks and valleys.

Some of the most recent speedup is the direct result of Goro (gfx) Fuji's work on Class::MOP and Moose as sponsored by the Japan Perl Association. Much thanks to all involved in that.