langalex / couch_potato

Ruby persistence layer for CouchDB.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"eql?" performance issue / rails url helper

kaipr opened this issue · comments

I recently noticed some rails url helpers to be exceptionally slow (120ms in some cases) and tracked it down to the use of "eql?" on couch_potato models. For some reason a standard book_path(book) results in a book.eql?(book) call, resulting in 2 to_json calls on the book (which is no problem for other ORM/ODMs).

Is there any reason to do content comparisons there? ActiveRecord, mongoid etc. all do id comparisons only and as there is no test for content equality in couch_potato, I would assume it's not needed here too?

I'll do a pull request later, but wanted to know if there is or was a reason for the content comparison.

I can't remember any reason, so a pull request would be great.

Thanks, I (finally) pulled this in after debugging a performance issue for 2h that came down to exactly that.