When working on the first few drafts of @ClojureDart we had a diary. We wrote down reasoning behind the design/features. Unfortunately it was not blog posts
Yay! Clojure crunching fibonacci numbers faster than C! Over at Clojurians Slack, @valerauko came up with a way to trick the #Clojure compiler and JVM JIT to generate code that runs at 200ms for “fib 40” on my machine. Significantly faster than the C version currently used by the Languages project, which runs at 250ms. We're not completely sure why this happens. The same trick can be applied to the Java implementation, which then runs at C speed. (So there are two mysteries here.)
The code needs to be compiled with direct linking, so if you try this: Compile the code using the binding in the Rich comment form before running the benchmark, which will run on the compiled class as long as you don't save the file after compiling. Also:
- To compile you need to have a `classes` subdirectory at the project root.
- To run the compiled class, `"classes"` needs to be on your classpath.
For anyone wondering why we don't go for iterative or tail recursion. It's not the point with this benchmark, which is using naïve fibonacci to see how recursion and function call overhead is handled by a given language.
We've been asked many times how to configure a CI for building iOS/macOs/Android apps with ClojureDart. Here is a repo using Github Actions with a full working configuration. https://t.co/jom8fMvuVk