(cross post from
but I haven’t gotten an answer yet)
I’ve got a simple model called “Search” used for storing searches. It
captures the URL params and stores them in an attribute
:search_criteria, which is serialized as a Hash:
serialize :search_criteria, Hash
This all works perfectly, but it performs horribly. For only 5 objects,
the following statements take roughly 0.2 seconds.
If, however, I remove the serialize line (such that search_criteria
returns a string) the statements take only 0.002 seconds. That’s 2
orders of magnitude difference for deserializing a Hash!!
What’s happening here? I’ve tried this on multiple systems, including
Heroku, and it’s the same everywhere.
Rails.version = 3.2.8
Ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]