AOT-compilation of graphs on the JVM, improving performance by leveraging JVM-specific code generation (via clojure.core/eval
) and primitive values.
Compared to the reference mapdag interpreter, addresses the following sources of execution overhead:
:mapdag.step/compute-fn
(via clojure.core/apply
). This implementation generates arity-aware code.:mapdag.step/compute-fn
), impeding JIT optimization. This function eschews this by generating code which defines one function per step, and does static dispatch on the keys (using clojure.core/case
).AOT-compilation of graphs on the JVM, improving performance by leveraging JVM-specific code generation (via `clojure.core/eval`) and primitive values. Compared to the reference mapdag interpreter, addresses the following sources of execution overhead: 1. Dynamic argument passing to the `:mapdag.step/compute-fn` (via `clojure.core/apply`). This implementation generates arity-aware code. 2. Map-based navigation. This implementation generates code that navigates the graph through primitive array lookups. 3. Megamorphic JVM call sites (when calling the `:mapdag.step/compute-fn`), impeding JIT optimization. This function eschews this by generating code which defines one function per step, and does static dispatch on the keys (using `clojure.core/case`).
(compile-graph {:as _opts
output-keys :mapdag.run/output-keys
input-keys :mapdag.run/input-keys
:or {input-keys false output-keys false}}
graph)
Performs Ahead-Of-Time compilation of the supplied mapdag graph. Uses clojure.core/eval
.
When known in advance, the available input keys and requested output keys may be supplied, allowing for an even more optimized computation.
Returns a function which accepts an inputs-map and (when not supplied AOT) output-keys, and returns a map.
Performs Ahead-Of-Time compilation of the supplied mapdag graph. Uses `clojure.core/eval`. When known in advance, the available input keys and requested output keys may be supplied, allowing for an even more optimized computation. Returns a function which accepts an inputs-map and (when not supplied AOT) output-keys, and returns a map.
(compile-with-known-input-and-outputs graph input-keys output-keys)
(explained-code expl-vec)
(explained-code expl-vec expr)
A noop macro for emitting self-commenting code.
The first expl-vec
argument (typically a vector) can be used for commenting, and won't be emitted in expansion.
The unchanged second argument (or nil if not supplied) will be the result of macro-expansion.
A noop macro for emitting self-commenting code. The first `expl-vec` argument (typically a vector) can be used for commenting, and won't be emitted in expansion. The unchanged second argument (or nil if not supplied) will be the result of macro-expansion.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close