May 13, 2007 at 8:10 pm
· Filed under Rails tips
I have done some research through the weekend about improving Rails Applications performance. I would feel the the following few points need to be considered when we optimize rails applications for performance:
1) Avoid the use of dynamic URL generation (link_to, url_for) since rails needs to look up the routes table and that may take time. Just hard code the controller name and the action.
2) Try to avoid the excess use of helpers since it adds overhead.
3) You may consider to use Rails Bench to do some testing for you rails application performance.
4) You may consider to use memcached to cache your model and library computation results.
5) you may consider partial caching for your view partials.
6) try to optimize your database queries. If you use ActiveRecord find, be careful from computation intensive sql queries that returns to you a lot of data that you may not need. The method find may run many select statements for you.
These are very few tips, I will write about Rails performance in more details soon.
Permalink
May 11, 2007 at 8:59 am
· Filed under Rails tips
This is how you issue 404 in Rails:
Permalink
May 10, 2007 at 2:04 pm
· Filed under Ruby Hash
This sample shows how to add element to ruby hash
Permalink
May 9, 2007 at 5:14 pm
· Filed under Ruby Numbers
How cute! Single line swap in Ruby. When I tried to do a single line swap in C, it was something like a^=b^=a^=b.
Permalink
May 9, 2007 at 4:52 pm
· Filed under ruby Strings
This piece of code converts Ruby Characters to ASCII code and vice versa.
Permalink
May 9, 2007 at 4:48 pm
· Filed under ruby Strings
These are different ways to divide or slice ruby string. All of these statements gives the same output.
Permalink
May 9, 2007 at 12:45 pm
· Filed under ruby Strings
This is a simple example that shows how ruby string successor works.
Permalink
May 8, 2007 at 3:57 pm
· Filed under Ruby Regular Expression, ruby Strings
The following piece of code validates any email that ends with .com, .edu, .org or any three letter extension. It uses regular expressions to find a match.
Permalink
May 8, 2007 at 7:52 am
· Filed under ruby Strings
In my last post, i gave a simple snippet to reverse ruby string. Here, I am giving simple snippet to reverse ruby string words. So, given string like “ruby on rails”, the output going to be “rails on ruby”.
Permalink
May 8, 2007 at 7:44 am
· Filed under ruby Strings
This how we reverse entire string in ruby :
To reverse ruby string words, check this link.
Permalink