While chatting in the higgsjs chat room, Molly and I found out that several people had tried running Higgs on OSX systems without success. Since she and I both run Linux as our main OS, we were both unaware of the portability issues involved. The unfortunate thing is that this situation has probably been going on for months, and nobody had told us until now. It makes me a little sad to think that, quite possibly, several dozen people may have tried and discarded Higgs after running into such problems. Fortunately, Paul Fryzel has generously been helping us test and debug Higgs on his Mac and we're now pretty close to a working solution. Molly will also be testing Higgs on BSD for good measure.
Molly Everett has completed the first version of a simple 2D drawing library (lib/draw) based on xlib. This library ships with Higgs and allows rendering simple static and interactive graphics.
We've decided to add an examples directory to the Higgs repository to showcase usage of Higgs-specific libraries and language features. This currently includes a "Hello World" example for the draw library, and a simple pong game clone built for Higgs.
I've been spending most of my time working on a paper on Basic Block Versioning (BBV) and incremental compilation. The results so far are very encouraging. BBV is able to eliminate more type tests than a static analysis, and produces measurable improvements in running time on the benchmarks we've tested it on. The graph below shows some preliminary results on part of the set of benchmarks tested (lower is better):
While working on the paper, I've been optimizing the size and quality of the code generated by Higgs so as to improve performance. I also discovered a strange anomaly in the results. Running the static type analysis produced a very significant slowdown (over 2x) on some benchmarks, even when the results of the said analysis were not used. Simply running the analysis in the same process brought a huge performance penalty in terms of execution time, with the time taken by the analysis itself excluded from measurement.
This led me to discover that the D garbage collector, which is used by the type analysis, is very inefficient, and performs much worse when there is more data allocated. Higgs has its own heap for JS code, but sometimes needs to perform allocations when interacting with the host runtime (written in D). These allocations were much slower than I expected. With a simple change, I was able to eliminate most of them. I also decided to pre-allocate memory for the D garbage collector in order to reduce collection frequency. To my surprise, this yielded a 4x performance improvement on several benchmarks.
It seems i've been able to convince my PhD advisor (Marc Feeley) that the next phase of my research, after the current paper is submitted, should focus on extending basic block versioning to add object/field type analysis capabilities. In my opinion, the right way to do this is to implement a system of typed hidden classes (or shapes, as the Mozilla people call them). This should make it possible to eliminate many more type tests, and accelerate property accesses as well as method calls. As an added bonus, a proper implementation of hidden classes will provide a better foundation to efficiently implement getters and setters in Higgs.