Performance regression in activerecord scoping

I opened this issue on the performance regression with scoping in the new release of rails from 4.2. I ran memory profiler on 4.1.10 and 4.2.0.

It’s only portion of the output from memory profiler, but how do the results look?

For example, I noticed that in 4.1.10 allocated memory for query_methods.rb was about 66 MB, but then in 4.2.0 it jumped to 162 MB.

Could you post the diff of that method between 4.1.10 against 4.2.0? :smiley:

Here’s a paste bin 4.1.10 4.2.0 diff on query_methods.rb - Pastebin.com

Ok lets zoom in further. Now we know the file that is taking up more memory, we need to figure out which change in that file is the culprit. :smile:

Btw be sure to benchmark against Rails head too. We might be doing all the work here when Rails head has already recovered the performance.

Seems like that’s the case since memory usage for query_methods.rb decreased when testing against master, but at the same time it feels like my tests are off.