celluloid/celluloid — pull request #370 by cheald (2014-01-27 22:58:08+00:00)
Title: Replace case statements with class clauses with instance_of? checks.

Ruby's case statement does a === comparison against modules, which walks the entire class hierarchy for each comparison looking for a match. Since we're looking for an exact class match, rather than any class that inherits from the tested class, we can optimize this by using `instance_of?` rather than `===`.

I don't have benchmarks for it yet, but when debugging the other issue, JRuby was showing an awful lot of time being spent doing module hierarchy traversal. I'll see if I can get formal benchmarks put together for it.