p5-MOP speedups, new traits and more ports

I recently took a vacation with my family and actually didn't spend any time working on p5-mop-redux (or any code for that matter) which was actually kind of nice (odd but nice). But thankfully Jesse Luehrs, my co-conspirator on the previous p5-mop attempt, found himself with some free time and so was hacking away. He ported one of his newest modules, Reply (which is a really nice REPL for Perl, you should try it) and noticed that the startup time was pretty slow (something important for a REPL). Of course this is to be expected in a prototype, but still, Jesse went and added this simple method cache which resulted in an almost 3x speedup for startup time.

Jesse also added two new class traits both of which are important for enabling users to subclass MOP based classes using non-MOP based classes.

The first trait is called closed, which behaves similarly to make_immutable in Moose in that it prevents any further modification of the class via the MOP and provides a bit of a speed boost at runtime. It also is what enables a MOP class to be inherited by non-MOP classes (I will spare the gory details of the implement, interested readers can look here to see).

The second trait is called repr and allows you to change the underlying ref type used by p5-MOP. Currently p5-MOP uses a blessed SCALAR ref, but potential non-MOP subclasses might expect a HASH ref or something else. Since p5-MOP doesn't care either way, Jesse simply added the features necessary to support changing it.

In addition to Jesse's Reply port, Damien Krotkine also finished up the port of his Action::Retry module. All this porting inspired me, upon my return from vacation, to finish up my port of my Bread::Board module. This brings us to a total 8 ported modules, which we are now smoke testing using Travis. If anyone else has a ported module that they would like to include, please contact me and we can add it to the list.

Well, thats all for now, I will be writing up another blog post this week about my experience porting such a Moose heavy module as Bread::Board and what I noticed during the process.

Leave a comment

About Stevan Little

user-pic I am the original author of Moose and am (again) working on the p5-mop project to bring some of the core features of Moose into the core. I am also conducting a thought experiment called Moe to see what an Ultra Modern Perl 5 would look like.