protobuf-ruby/beefcake — pull request #46 by grobie (2014-01-15 17:37:24+00:00)
Title: Use hash lookup instead of case statements

Small improvement I found after using ruby-prof. case statements are usually performance killers in ruby, so better to avoid them.

Before (bench/simple.rb):

```
user system total real
object creation 0.020000 0.000000 0.020000 ( 0.015672)
message creation 0.490000 0.000000 0.490000 ( 0.492956)
message encoding 2.950000 0.000000 2.950000 ( 2.946238)
message decoding 4.110000 0.000000 4.110000 ( 4.106664)
```

After:

```
user system total real
object creation 0.010000 0.000000 0.010000 ( 0.015033)
message creation 0.510000 0.000000 0.510000 ( 0.507569)
message encoding 2.800000 0.000000 2.800000 ( 2.798945)
message decoding 3.850000 0.000000 3.850000 ( 3.848129)
```