byroot/activerecord-typedstore — pull request #8 by arthurnn (2014-02-13 21:11:21+00:00)
Title: Performance regression.

### Problem
`define_attribute_methods` is slow, `AR.respond_to?` call that method, in every call:
https://github.com/rails/rails/blob/4-0-stable/activerecord/lib/active_record/attribute_methods.rb#L202

this was introduced after https://github.com/rails/rails/commit/30efdd6e9066684dc952966ed71e23a9c7640e7e .

### Solution
Make sure we dont define the methods more than one time. Almost the same way that AR does.

Benchmark using mysql+shopify Gemfile
```
Before:
user system total real
18.800000 81.110000 99.910000 (112.324601)
After:
user system total real
2.310000 31.300000 33.610000 ( 40.771561)
```
Benchmark using sqlite3, on vanila rails4-0 stable app
https://gist.github.com/arthurnn/b6b2dc053786b32bf94a

cc @jduff @camilo
review @byroot