[ABANDONED] An optimizing Clojure compiler
Then, I heard it. The click of the mic button from the back seat. Very professionally, and with no emotion, Walter spoke: "Los Angeles Center, Aspen 20, can you give us a ground speed check?" There was no hesitation, and the replay came as if was an everyday request. "Aspen 20, I show you at one thousand eight hundred and forty-two knots, across the ground."
–– Brian Schul, "Sled Driver: Flying the World's Fastest Jet"
Oxcart is a prototype Clojure compiler which seeks to provide aggressive AOT compilation for performance and memory usage. At present Oxcart is a holding tank for changes which will likely be split up between tools.emitter.jvm, tools.analyzer.jvm and some future
Oxcart is currently on indefinite hiatus, pending changes to Clojure addressing the current
clojure.lang.RTbehavior of loading clojure/core from source. See the blog posts for more information.
Stuff I read prior to starting Oxcart
The script "bench.sh" in the root of the Oxcart project is designed to run the various Oxcart benchmarks with minimal effort. Usage is
bash bench.sh NSwhere
NSis the namespace in the Oxcart source tree to be run as a benchmark. That namespace will be loaded first with Clojure 1.6, and then compiled & run via Oxcart. Runs are wraped in
timeinvocations, although several benchmarks do their own timing internally.
bash bench.sh test.call
This namespace is designed to assess the cost of making function calls between Oxcart and core Clojure. It repeatedly invokes the
test.call/vcallfunction to perform primitive arithmetic and is intended to measure the speedup from eliminating var indirection on
bash bench.sh test.hello
This namespace just prints "Hello, World" as a test. Not actually a benchmark, unless you want to measure how long it takes to boot a Clojure instance, do minimal work and exit.
bash bench.sh test.load
This namespace loads a slightly modified version of
test.vars, except that all the vars but
test.load/-mainare unreachable. This is intended as a demonstration of how slow it is to compile programs from source compared to loading them from compiled classes.
bash bench.sh test.vars
This namespace defines 502 functions, most of which are trivial, and then calls a random set of them in a tight loop. This is also designed to stress the costs of var indirection as the tight loop function is much too large to reasonably inline across and the set of vars called in each iteration is random on each pair of possible functions which kills the branch predictor and increases the inlining cost.
Copyright © 2014 Reid McKenzie, Rich Hickey & contributors.
Distributed under the Eclipse Public License, the same as Clojure.