From: dblack@... Date: 2007-08-03T02:04:05+09:00 Subject: Re: sytnax Hi -- On Thu, 2 Aug 2007, Phlip wrote: > Shai Rosenfeld wrote: > >>> var = { 1 => 'one', 2 => 'two', 3 => 'three' }.fetch(number, 'else') >> >> nice! :) >> >> any lead to which one is faster? > > D'OH! > > (There was just a big discussion on Ruby performance, or lack thereof. > Google "Performance diffrence between ifs and case", and learn A> > premature optimization is the root of all evil, and B> you can profile > each system with unit tests and Benchmark library.) Not all optimization is premature, and it's not the case that no information is available to people before they start to code something, or even just out of academic or scientific interest quite apart from any particular coding project. There's a long history of quite interesting discussion about performance on this list, often involving benchmark reports (and therefore explicitly in the knowledge of the relevance of the benchmarking process). Those discussions can be very illuminating, and I'd prefer not to see them routinely squashed before they have a chance to start. David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)