Category Archives: Ruby

orm_adapter + NoBrainer = <3

After trying and falling in love with RethinkDB, I began using the NoBrainer ORM with some of my Rails side projects. And while the combination is fantastic and productive, I’ve hit many of the roadblocks that frequently come with straying from ActiveRecord.

One of those roadblocks has been the lack of orm_adapter support for NoBrainer. Used by a variety of gems (chief among them the popular Devise authentication framework) to provide ORM abstraction, orm_adapter support is a necessity for easy growth and development.

And today, it’s here with orm_adapter-nobrainer. Written to scratch my own itch, it’s available on GitHub and pushed out to RubyGems for wider distribution and use. While not entirely complete — it doesn’t yet address the writable associations NoBrainer doesn’t implement — all other tests are passing and it should be a drop-in implementation for most real-world uses.

Similar work still needs to be done for Devise itself, but this is the foundation for that work (and a whole bunch more).

Hopefully it makes someone’s life a little easier. Pull requests and issues are always welcome.

Behold the Glory of Ruby 2.1

With some of the changes in the forthcoming Ruby 2.1 (specifically garbage collection), I thought it would be interesting  to throw some (synthetic) benchmarks at it. In a couple internal benchmarks, it offered noticeable performance increases.

For a more well-known point of comparison, I turned to Mike Perham’s Sidekiq benchmark. The results were… unexpected.

MRI 2.1.0-preview1: 30 seconds
JRuby 1.7.4:
39 seconds
MRI 2.0.0-p247: 82 seconds

No, your eyes do not deceive you: Ruby 2.1.0 bested even the venerable JRuby. This outcome was so surprising that I ran the benchmark again several more times than I’d intended. The results didn’t change; 2.1.0 reproducibly came out ahead of JRuby by around 10 seconds.

While there are certainly other good reasons to go with a JVM-based interpreter, Ruby 2.1 may well turn out to be the response to many users’ performance needs—all while maintaining native extension compatibility and using the gems you know and love.