Find Related products on Amazon

Shop on Amazon

Running Clojure in WASM with GraalVM

Published on: 2025-08-04 11:50:07

Running Clojure in WASM Apr 26, 2025 Starting from v25 GraalVM added support for WASM backend for Java programs compiled to native image, which means that it's finally becomes possible to compile and run Clojure programs in WASM! Although WASM backend is in its early days, and doesn't support threading and networking, it is already possible to compile and run single-threaded computational programs in Java/Clojure. If you open browser console now, on this page, you'll see Hello, World! printed in the console. That's a Clojure program talking to you :) (ns core (:gen-class)) (defn -main [& args] (println "Hello, World!")) Binary size The output WASM of this simple program is 5.6MB binary, which can be pruned a bit via wasm-opt tool, just make sure that it doesn't break anything for you. Luckily when compressed (gzip, brotli, etc) the binary becomes just ~2.5MB in size. After running the binary through wasm-opt I got 5MB output, so roughly ~600KB less ones and zeroes. wasm-opt cor ... Read full article.