In this Ruby 1.8.7 application, YAML deserializing (done with YAML.load) is needed because the existing data is stored in many relatively small YAML documents, but is a performance bottleneck.
Is there a way or a library that has this better? Upgrading to ruby 1.9 is not an option.
I didn’t find a way to do this. I’ve tried converting YAML to JSON via string manipulation, then parsing that with fast JSON parsers such as Yajl and OJ, but the overhead of converting YAML to JSON was already longer than actually parsing YAML.
My conversion script probably wasn’t as fast as it could be if someone smart really dedicated a lot of time to do this, but I gave up on this early after I realized even if I optimize my own script, it still wouldn’t beat YAML parsing time significantly enough to warrant the whole approach.