#1438 ✓resolved
Alexander Sorokin

Performance degradation due to unnecessary inspect calls

Reported by Alexander Sorokin | October 26th, 2010 @ 01:44 PM | in 1.1

We're trying to upgrade to DM 1.0.2 from 0.10. We observed 3x performance hit for the new Datamapper. The performance degradation affected both specs (total time to run) and the running system (response time).

Upon investigation, I found that there are too many calls to "inspect" methods. I traced them down to Query.assert_valid_fields (ln 797). That inspect call isn't necessary unless there are errors. I also found the following unnecessary calls:

lib/dm-core/query.rb
792: inspect = field.inspect
821: inspect = inspect = link.inspect
849: inspect = subject.inspect
936: inspect = order_entry.inspect

lib/dm-core/associations/many_to_one.rb
158: collection = source.collection

I don't think this is a complete list

After fixing these particular instances, I was able to get from 3x time down to 2x time compared to DM 0.10.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Referenced by

Pages