Skip to content

Instantly share code, notes, and snippets.

@kabutz
kabutz / Fib.txt
Last active October 26, 2016 15:22
A simple exponential time shootout between C, Java and Swift
/*
Algorithm is exponential - very bad. It is just meant to exercise the CPU a bit and
to see what happens with different languages. Not representative of real code.
Interesting that Java beats C, thanks to HotSpot. I expected Swift to be as fast as C
at least. I also expected the compiled Swift to be faster than when run as a script.
A bit disappointed, but more time needed to see where the bottlenecks are. Plus I
need to run some real code for benchmarking.
Update: swiftc -O improved the speed quite a bit to be about the same speed as Java