Awelon Progress Report IV

I spent most of March attempting different approaches to improve AO’s performance. This isn’t what I set out to do. At the end of February, I wrote: “My plans for the next month are to start building functions for data structures: maps/records, sequences, streams.” And I did make a little progress in that direction – but not nearly enough to pretend I met my goals. Performance remains a pain point for me; I really wish to start developing applications within AO – such as an IDE, so I can ‘dogfood‘ the development of AO. But that’s simply impractical if the performance of the resulting application is inadequate. I fell to the siren song of performance pursuits.

Early in the month, I finally cleared a few tabs from my browser, reading Laurence Tratt’s excellent article, Fast Enough VMs in Fast Enough Time (highly recommended to anyone developing a PL), which describes how PyPy can construct a JIT compiler from an interpreter. I tried my hand at this for ABC, but I suspect I’ll need a more explicit memory model to meet PyPy’s restricted python (RPython) constraints. I might get back to this later. At the moment, the PyPy interpreter for ABC has approximately the same performance as the aoi interpreter in Haskell.

I had more success with a second attempt:

I’ve implemented a simple AO to Haskell translator. From the AO package, `ao dict2hs` will convert the entire dictionary into one Haskell module, AODict, using a simple name mangling scheme. This relies on an externally provided AOPrelude module for definitions of the ABC primitives. This is a very naive, direct translation, but the AOPrelude can (and does) include GHC rewrite rules. The resulting (profiled) Haskell object file is about 12 megabytes for 1141 words, or about a third that for non-profiled code. (The raw Haskell code is 242kB, where the AO dictionary is 144kB. Much of this is documentation (doc.) words.) The only tricky bit was ensuring AO can use Haskell’s TCO, which I eventually achieved by specializing the `$c` sequence. This development comes with a few new utilities for running AO tests and executing AO programs (`aoTest` and `aoExec`).

The performance of this translation seems pretty good for “straight-line” code. For example, `aoTest` and `ao test` run the same tests, but the former runs two orders of magnitude faster (0.012s vs. 1.38s). I was very excited by these numbers. Sadly, they didn’t generalize. Upon implementing a simple loop code (`@bench.repeat100k 0 [4 .add] 100000 repeat 400000 assertEQ`) I discovered a performance factor closer to 6 (from 2.42s to 0.40s). Further, I suspect that the improvement will prove very marginal for deep metaprogramming (where partial evaluation and JIT become more essential).

Despite the limits of this technique, it may be enough to begin dogfooding further development of AO.

So, that’s my plan this April. I’ll need to develop the `aoExec` powerblock a fair bit to perform useful side-effects, but that should not take long. I will need to test the `{&async}` annotation, which I implemented in the AOPrelude. I’m hoping, within the next month or two, to develop a few simple web applications mostly within AO, and eventually shift development of AO from filesystem + gedit into a persistent, wiki-like service. As AO’s performance further improves, more domains should open up to it.

About these ads
This entry was posted in Language Design. Bookmark the permalink.

5 Responses to Awelon Progress Report IV

  1. Neo says:

    Keep up the good work. I’m really looking forward to start playing with this stuff once it gets a bit more mature :)

  2. Donald Taylor says:

    I add my encouragement too. Though I admit I’m out of my depth with what your doing, the objectives you describe sound very interesting to me. Always liked dataflow computation models, and have been looking for a way to abstract the process of making it a two way street- an abstract dynamically tunable pipeline/graph.
    Can I be rude and ask who you are? Can’t seem to find an “About dmbarbour” page. I only ask because my FP/DSL knowledge is insufficient to assess your approach properly, so I’m looking for any other credentials that can help give me confidence that your bigger claims carry some weight. Don’t mean to sound doubtful… I think you’re on to something!

    • dmbarbour says:

      Thanks for the encouragement.

      I don’t have a credentialed name and history to offer weight to my words beyond the ideas they express. Readers must judge my claims and arguments by their merits. This may be difficult for people who aren’t already walking a similar path. I believe RDP will be easiest to understand by using or seeing it used. I think it entirely reasonable that most readers maintain a healthy level of skepticism until I demonstrate and share my ideas in an industrial context.

      • Donald Taylor says:

        I hope you get the affirmation you need to keep you motivated. Sounds like a lonely path to tread if you have more sceptics than allies. Given that you’re up there grappling with the high abstract I don’t imagine there is much scope for you to take many others along for the ride. Too unique to you – which is a blessing and a curse.
        Do you at least have any kind of patron for support?
        I intend trying to understand, and to support however I can. :-)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s