Well, there are certain well known practices like string concatenation is way slower than "#{value}" but in order to find out where you script is consuming most of its time or more time than required, you need to do profiling. There is a ruby gem called ruby-prof. The profiler can bring to your notice even those performance issues that may rarely occur. I have been using it a lot and find it very helpful. Here is some information about it directly from its official site
  ruby-prof is a fast code profiler for
  Ruby. Its features include:
  
  Speed - it is a C extension and therefore many times faster than the
  standard Ruby profiler.
  
  Modes - Ruby prof can measure a number of different parameters,
  including
          call times, memory usage and object allocations.
  
  Reports - can generate text and cross-referenced html reports
  
  Flat Profiles - similar to the reports generated by the standard Ruby
  profiler
  
  Graph profiles - similar to GProf, these show how long a method runs,
  which methods call it and which
  methods it calls.
  
  Call tree profiles - outputs results in the calltree format
  suitable for the KCacheGrind profiling
  tool.
  
  Threads - supports profiling multiple threads simultaneously
  
  Recursive calls - supports profiling recursive method calls