Friday, July 9, 2010

Just for Fun

Looked at the new language Rust. I couldn't really make sense of it yet - why this language, what do they miss in other languages? Thought it be nice to compile a test of Ackermann too.

Oops, almost hogged my disk since tracing was turned on while running Ackermann on input 4 1.

Ran Ackerman 3 8, it ain't as fast as I hoped, around 14 secs . Of course, in comparison to other languges, the runtime is oblivious to the actual types of integers, all primitive arithmetic calls are dynamic and through libffi -no memoization yet,- addition is overloaded so a method is selected dynamically, I don't have generational garbage collection, I don't inline simple functions, and I couldn't get it to compile cleanly through GCC with all optimizations turned on [1]. Basically, I am not measuring integer arithmetic, but the speed of garbage collecting, selecting methods, and making dynamic calls [2].

Not unhappy though. Approximately every optimization I could do would take off 25-50% of running time. So, I expect this benchmark to end somewhere around Lua speed, the bottle neck then being not having native integer types and libffi.

[1] GCC solved, -fno-strict-aliasing did it. Thanks to Cedric Roux of GCC-help, down to 8 secs.
[2] Profiling with -O3 now gives 35% garbage collection, 35% libffi, 30% calculation.

No comments:

Post a Comment