I upgraded my ruby 1.8 to the latest patchlevel and all of a sudden ruby-marc was super-slow. I found the same thing on 1.9 and in JRuby, so I investigated.
There's a marc.bytes.to_a
call inside the loop in Reader#decode. All the fix does is move it outside the loop so it only happens once.
You can see the patch in the "slowreadfix" branch at https://github.com/ruby-marc/ruby-marc/commit/beba83745ebe0848218496e967edd65d632fb01e
As you can see, the speedup is about a factor of five.
Test case is reading in a Marc21 file with about 18K records in it.