TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Making ActiveRecord 2x faster

158 pointsby tenderloveover 11 years ago

10 comments

chealdover 11 years ago
It&#x27;s good to see members of the Rails core team taking performance seriously. I&#x27;ve been on a personal performance quest for the last couple of years, and what I&#x27;ve discovered is that the Rails community as a whole (not necessarily the core developers, but just people producing Rails-related software as a whole) really seems to consider performance to be something of an afterthought. There is a <i>lot</i> of low-hanging fruit laying around that could substantially improve quality of life for the entire Rails ecosystem if people would put a little time into profiling their stuff and eliminating hotspots.<p>It&#x27;s been very discouraging to me to see responses to performance issues that range from lukewarm to plain &quot;I don&#x27;t care&quot;. The Rails community could benefit a lot from a visible push by the core team to make performance a priority.
评论 #7266426 未加载
评论 #7265989 未加载
评论 #7267237 未加载
评论 #7266278 未加载
thibaut_barrereover 11 years ago
Quoting @tenderlove: &quot;I think we can make the next release of Rails (the release after 4.1) the fastest version ever.&quot;<p>I&#x27;m glad to see the gradual progression since 3.2 stable!
midas007over 11 years ago
Props for Aaron&#x27;s continuous work on <i>mature</i> optimization of Ruby &amp; Rails. I recall his yeoman&#x27;s work on Ruby dtrace probes and Rails initialization time.
mrcwinnover 11 years ago
I applaud anyone trying to improve performance. It is discouraging, though, that it only helps with some of the fastest and most efficient queries: direct SELECTs by ID without any joins or LIKE statements.<p>For those interested in good caching without bypassing parts of ActiveRecord, Memcache + Dalli (gem) is a great solution. Caching is not always the right solution, though. Sometimes the best choice is reversing how you get to that data or optimizing your query directly using SQL.
评论 #7266533 未加载
jrochkind1over 11 years ago
I am skeptical as to whether the calls speeded up by this optimization form a sufficient portion of the actual call time of any actual real world apps actions, such that this optimization will have any non-trivial effect on a real world app.<p>It might. But I definitely wouldn&#x27;t assume it does. Micro-optimization.<p>Of course, it doesn&#x27;t hurt either way, unless it does in code complexity, or opportunity cost.
ikaweover 11 years ago
This seems to be but a first step - it&#x27;s currently limited only to calls of the form `Article.find(id)` and `Article.find_by_xxx(value)`.<p>e.g. `Article.where(xxx: value)` or `Article.where(xxx: value).last(3)` will not benefit from this improvement yet.
评论 #7266573 未加载
adamkittelsonover 11 years ago
Isn&#x27;t the find_by_XXX style (soon to be?) deprecated?
评论 #7266078 未加载
评论 #7266187 未加载
sheffover 11 years ago
Something else to look forward to in 2014 for Rails performance, along with the planned arrival of JRuby 9k !
troykover 11 years ago
It appears the 2x speedup is from by-passing ActiveRecord::Relation
mikkelewisover 11 years ago
Will this work for Rails 3.2?