Pretty cool. I’m curious how this compares to doing direct find_by_sql queries, if anybody’s tried that.
Just speculating here, but I think if you were to do find_by_sql queries in the same benchmark he’s using, you’d find them just as slow. My thinking is that his optimization is to cache the prepared statement, but with find_by_sql you’d be recreating that string every iteration and losing the benefit. However if you were to create the stored procedure outside the loop and only call it from within, you might get similar results.
This is yet another reason I like using frameworks when possible. Someone else is (almost) always looking to upgrade it for me, for free. :)