This project is archived and is in readonly mode.

#6304 ✓stale
Miguel San Miguel

Making find a little faster

Reported by Miguel San Miguel | January 17th, 2011 @ 09:45 PM

The find method can be made just a little bit faster. Nothing to be perceived on a single run, but to be noticed after some running up requests.
Basically, we can replace the case/when statement with a if/include, gaining 10% speed on that.
See more details and a demonstration of the improvement in my post on this issue (sorry for self citing).
I attach a diff with the suggested code. I tested it against the provided suite and it passed.
It just needs to be reviewed and applied.

Comments and changes to this ticket

  • Miguel San Miguel

    Miguel San Miguel January 17th, 2011 @ 11:29 PM

    Sorry, I forgot to check exhaustively. It looks like it is very dependent of the usage. If your application has many find_by_ids (which I do not think is the normal case), then my patch works 40% faster. If not, 25-30% slower.

    I vote for forgetting about it...

  • rails

    rails April 19th, 2011 @ 01:00 AM

    • State changed from “new” to “open”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • rails

    rails April 19th, 2011 @ 01:00 AM

    • State changed from “open” to “stale”

Create your profile

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

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket