Under typical circumstances, the method ActiveRecord::Base.can_wrap_with_hobo_type?(attr_name)
gets called very often and it has a dismally slow technique for determining if an attribute
can be wrapped. Namely, it tries calling attr_type(attr_name) and checks to see if that
raises an error.
In rails, raising errors in the ordinary course of doing business is extremely
costly since the stack traces that get created before the rescue are absolutely
huge.
I propose memoizing this method since there are only a few distinct attributes
but they may be accessed many, many times.
Under typical circumstances, the method ActiveRecord::Base.can_wrap_with_hobo_type?(attr_name) gets called very often and it has a dismally slow technique for determining if an attribute can be wrapped. Namely, it tries calling attr_type(attr_name) and checks to see if that raises an error.
In rails, raising errors in the ordinary course of doing business is extremely costly since the stack traces that get created before the rescue are absolutely huge.
I propose memoizing this method since there are only a few distinct attributes but they may be accessed many, many times.
I will submit a PR straight away.