I really haven’t done much any performance tuning, but MY GOD.
sammael:rubyGP greay$ time ruby tinyGP.rb
real 0m26.821s
user 0m25.995s
sys 0m0.647s
sammael:rubyGP greay$ time java tiny_gp 23 sin-data.txt
real 0m0.495s
user 0m0.658s
sys 0m0.074s
sammael:rubyGP greay$ time macruby tinyGP.rb
real 0m1.199s
user 0m1.369s
sys 0m0.045s
This is just creating a population of 10000 individuals; nothing fancy. using OS X’s builtin (I think; I may have upgraded) ruby - MRI ruby 1.8.7, to be exact, that’s 26 seconds. Any amount of tuning I could throw at it, I don’t think I could get it down to the original java implementation’s < 0.5 seconds. Even if I’m doing something completely braindead, that’s a nearly 60x difference.
So I decided to try out MacRuby. I heard it’s better; it’s based on 1.9 and has a whole bunch of exciting things about it. LLVM! Integration w/the objective C runtime! And it’s fast! ~ 1.2 seconds! That’s waaaay better than the original ruby run, and it’s the exact same code. It’s still 3x slower than the java implementation, but like I said, I’ve done little to no tuning yet. But I’m happy w/3x slower for the time being… I want to play around w/the code a bit before I bother making it faster.