Hi, I was interested in translating Jon Harrop’s symbolic derivatives benchmark to Julia, but since the original code is really heavy on ADT’s and pattern matching I don’t really have a good intuition for what style would work best when translating it, especially if I want to take advantage of the small union optimization. AFAIK, Julia doesn’t allow union types to be recursive as in const Uniontype = Union{Int,Node1{Uniontype},Node2{Uniontype}…} .
The benchmark source code for various languages is in the following links:
Swift: Swift code to compute the nth derivative of x^x · GitHub
OCaml: https://gist.github.com/jdh30/f3d90a65a7abc7c9faf5c0299b002db3
F#: https://gist.github.com/jdh30/ae98e3fb548b120eb7a16777fbce449f
Mathematica: https://gist.github.com/jdh30/1b7eba8819dc8295b7a46b6e206efeb5
The blog post with the actual performance comparisons is here: http://flyingfrogblog.blogspot.com/2017/12/does-reference-counting-really-use-less_26.html