Optimised Ruby version; double speed.