Skip to content

The Tachyon JavaScript Compiler

August 27, 2011

Tachyon is the JavaScript JIT compiler I’m working on for my Ph.D. thesis at the Université de Montréal, under the supervision of Professor Marc Feeley. One of the things that makes this compiler special is that its implementation is metacircular, that is, Tachyon itself is written in JavaScript. We’re hoping this will make the implementation easier and simpler in the end, as writing code in a dynamic language like JavaScript can boost productivity, and there are some advantages to using the same language in the host compiler as the language that’s being compiled.

As you might have guessed, writing a JIT compiler isn’t enough to get a Ph.D per-se. My thesis work will be focused on designing and implementing novel optimizations into the compiler. Dynamic languages like Python, Ruby, Lua and JavaScript suffer from a significant performance disadvantage compared to static languages like C, Java and C#. I’m hoping my work will help make that performance gap smaller.

It’s obvious there has already been good progress in optimizing dynamic languages lately if you look at PyPy, Google V8, TraceMonkey or LuaJIT. People sometimes like to brag that such JITs perform better than C compilers on some benchmark programs. However, these benchmarks inevitably turn out to be microbenchmarks, with less than 40 lines of code, that are relatively easy to optimize. I can tell you that when we run the Tachyon code under V8 (~75KLOC of object-oriented goodness), the performance is nowhere near as good as it would be if Tachyon were written in C++. In fact, it’s probably about 50 times slower, if not more.

I think it’s fairly obvious that dynamic languages still suffer form a performance disadvantage, and I intend to do something to fix it. The focus of my thesis will be specifically on applying “optimistic optimizations” to dynamic languages. I may delve more into those in later posts. For the moment, you can read this paper if you’re curious about them (there actually isn’t much related work!).

We’ve gave a presentation about Tachyon at CASCON 2010 last November. I’m happy to announce we’ve just recently got a paper accepted at DLS 2011, which I will be presenting this coming October. This paper gives more insight into the design of Tachyon and how we got it to compile itself.

Tachyon is open source (BSD license) and already available online. I will wait a little bit before publicizing the repository URL, however, as I’m currently making some pretty big changes (rewriting the whole x86 backend). I think I might like to try and get help from people in the open source community at some point, if some people are interested in contributing to this project.

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s

%d bloggers like this: