ubuntu, ror, jQuery, css, website memo
太嫩, 沒啥心得, 用來紀錄每天學的
2010年3月3日 星期三
That’s Not a Memory Leak, It’s Bloat; refactor
That’s Not a Memory Leak, It’s Bloat
#:includes are Including Too Much
Article.find(:all, :include => [:user => [:posts => :comments]])
#:includes on a has_many
@articles.users.find(:all, :include => [:posts => :comments]])
#Use :select When You Must Instantiate Large Quantities of Records
@comment_ids = Comment.find(:all, :select => 'comments.id').collect{|comment| comment.id }
#Overfed Feeds
Check all the places you are making XML sandwiches. Often these controllers are written early on and don’t scale well. Maybe you have a sitemap XML feed that delivers every record under the sun to Google, or are rending some large amount of data for an API.
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言