Hague Grant Application: Meta-model Improvements and Natively Typed Attributes
Sun, 11-Jul-2010 by
Karen Pauley
edit post
We have received the following Hague Grant application from Jonathan Worthington.
Before the Board votes on this proposal we would like to have a period of community consultation. Please leave feedback in the comments or if you prefer send email with your comments to karen at perlfoundation.org.
**Name**
Jonathan Worthington
**Project Title**
Meta-model Improvements and Natively Typed Attributes
**Synopsis**
As Rakudo gains features, its relatively low performance is increasingly
being viewed as a blocker for continued progress and adoption. Prior to now,
a focus on Rakudo features has been a good thing; we have a releasable product
in Rakudo * that demonstrates the power of Perl 6, and working on optimization
prior to the features would have ultimately done more harm than good. As Rakudo
reaches a wider user base, it's time to examine some of the remaining tasks and
work on delivering a more performant Rakudo.
We have been able to build Perl 6 capabilities into Rakudo by starting out with
Parrot default components and gradually replacing them with Perl 6-specific
ones. A prime example of this is the object metamodel. Parrot's object model
has not mapped well to Perl 6, but in the "ng" branch work earlier this year
we have abstracted most of it to a well-defined API. However, the abstraction
is inefficient and in some places inadequate for implementing some features
from the Perl 6 specification.
The work this grant proposes aims to re-build what lies beneath the meta-model
API in a way that is far more optimal for Perl 6. Since this is used by both
Rakudo and nqp-rx, it will deliver both compile time and runtime speed gains.
Furthermore, the re-implemented meta-model will suport natively-typed attributes
and compact structs, enabling portions of Synopsis 9 to be implemented for Rakudo
(one of the areas where Rakudo and the specification are currently weakest).
**Benefits to Perl 6 Development**
This work will contribute towards addressing one of the most cited problems with
Rakudo Perl 6 today - its performance. It will also deliver more Perl 6
features, bring Rakudo still closer to the specification, and provide a basis
for further development. A faster, more complete Rakudo will attract
additional interest, grow the Perl 6 community and provide more feedback to
move much closer to having a full Perl 6 implmentation.
**Deliverables**
D1. A new, clean, efficient implementation of the core of the Perl 6 meta-model,
replacing the current P6object implementation.
D2. Modify nqp-rx to use the new meta-model implementation, particularly
enabling compile-time index offsets of attributes and detection of
mis-spelled attribute names.
D3. Modify Rakudo to use the new meta-model implementation.
D4. Implement natively typed attributes in Rakudo.
D5. Finish the pieces needed to enable writing custom meta-classes in
Rakudo and document how it is to be done.
D6. Review and ensure we have good test coverage for all of the above
deliverables.
**Project Details**
Deliverable 1 is the really big part of this project. The new meta-model
implementation should be capable of:
* Accessing object attributes by index offset rather than a more expensive
hash table lookup
* Having natively typed attributes
* Performing type checks (isa and does) faster than currently possible
* Providing custom dispatchers
* Supporting all features of the existing metamodel implementation
The core should not implement every Perl 6 feature, but rather provide a fast
implementation of the fundementals required to do so. For example, the core
metamodel itself may only support single inheritance, but it would be
possible to build multiple inheritance on top of this using the Perl 6
ClassHOW implementation.
Deliverable 2 involves converting nqp-rx to use the new meta-model. This will
provide some early feedback and experience that will guide the process of
integrating the new meta-model core with Rakudo. NQP is also a simpler target
than Rakudo. Work on the new metamodel will begin in a branch, which will
eventually replace the current metamodel that NQP uses.
Deliverable 3 converts Rakudo to use the new meta-model core. Essentially
this requires rewriting Rakudo's ClassHOW and RoleHOW in terms of the
new metamodel primitives. The aim will be to use nqp-rx as the primary
language for these objects, to simplify further development and prove
that they can be specified in Perl 6 with minimal "hacks" or "magic".
Deliverable 4 adds natively typed attribute declarations to Rakudo.
This will need some discussions with the Perl 6 and Parrot design teams
and some prototyping attempts. The end result should be the ability to
declare natively typed attributes as described in S09. The majority
of the S09 sized types will be implemented, and initial support for the
"compact structs" section will be provided.
Deliverable 5 completes the ability to create custom metaclasses that is
/almost/ present in Rakudo today. The above work on the metamodel should
allow this highly-requested feature to become available.
Deliverable 6 ensures we have good test coverage of this work. This
task will be ongoing as part of test-driven development in producing
the other deliverables above.
**Project Schedule**
Initial design work on Deliverable 1 will begin in July, with much of the
implementation work happening during August. Deliverable 2 should be
complete between the end of September and the middle of October. Deliverables
3 and 4 are targeted for November. Deliverables 5 and 6 will be done shortly
after that, meaning this entire project should be finished sometime in late
December.
**Report Schedule**
Blog posts will be made throughout the duration of the work on a blog which is
aggregated by Planet Perl 6.
**Public Repository**
All code, documentation and other relevant files that relate to Rakudo will be
checked into the Rakudo repository. The new P6object replacement will be
developed in the nqp-rx repository. All code, documentation and other
relevant files relating to Parrot fixes or additions will be checked
into the Parrot repository. All contributions to the specification
and specification tests will be checked into the Pugs repository.
**Grant Deliverables ownership/copyright and License Information**
All work on produced as a result of this grant will be licensed under
the Artistic License Version 2.0. I already have signed the relevant
CLAs for both The Perl Foundation and The Parrot Foundation regarding
my contributions.
**Bio**
I first started contributing to Parrot in 2003, and have previously
contributed to Parrot core development. I have been involved in Rakudo
development since December 2007, and have implemented a wide range of
features, with a primary focus on the object model, multiple dispatch,
and the type system. I am also a frequent speaker on Perl 6 and Parrot
at European Perl conferences and workshops. I have successfully completed
3 previous Hague Grants.
I also have strong academic underpinnings, holding a first class Computer
Science degree with honours from the University of Cambridge.
My unique combination of Parrot internals knowledge, in-depth
knowledge of Rakudo Perl 6, academic background, and previous
contributions to Rakudo and Parrot put me in a very strong position to
successfully deliver an implementation of the features described in
this proposal.
**Country of Residence**
Sweden
**Nationality**
United Kingdom
**Amount Requested**
$9000 USD (50% paid after D1 and D2 are completed; remainder when all complete)
Comments (4)
I use Rakudo on a daily basis. I, for one, wouldn't mind a speedup such as the one outlined here. :)
I also think Jonathan is the one to pull it off. Reading through all of the above, I find I understand what he's planning to do at a slightly-more-than-surface level. It seems sensible to me. I'm all for going ahead with this grant.
Putting the object metamodel on a faster, more solid foundation sounds very worthwhile. Also, a depper implementation of S09 will be a really good thing for Rakudo to have. It's all about treating aggreagate data in more efficient ways. I have a feeling Rakudo and Perl 6 will really start to shine once those parts start falling into place.
Jonathan has shown before that he can implement great things for Parrot and Rakudo, and I think this is another item that's worth supporting.
And performance improvements are desperately needed; anything that is either faster directly, or indirectly (avoiding GC pressure by producing fewer objects that must be scanned and collected) is appreciated.
I hate to be so "me too", but I greatly endorse jnthn for this grant. He's the "object guru" for Rakudo; he's the most likely person to be able to do it; he's performed admirably on previous grants; all of the items he has proposed to implement would be a boon for users of Rakudo; he should be awarded this grant.
And that's about all I have to say :)
jnthn is one of the handful of tireless developers who devote so much to Perl 6. He is unquestionably the 'expert' in the area of this proposal. Hague grants were targeted for exactly this type of proposal, and jnthn is exactly the right person for this job. The Perl Foundation should approve this immediately. (What? We've only been waiting 10 years ;-) Design the Metamodel of the Ages, jnthn!