Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Making find a little faster

#6304

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.

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

State: stale
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Miguel San Miguel
    Miguel San Miguel

    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...

    January 17th, 2011 @ 11:29 PM

  2. rails
    rails
    • 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.

    April 19th, 2011 @ 01:00 AM

  3. rails
    rails
    • State changed from open to stale

    April 19th, 2011 @ 01:00 AM