From: Erik Veenstra Date: 2006-07-13T22:35:33+09:00 Subject: Re: Recursion and Ruby > > ---------------------------------------------------------------- > > > > Version 1 100,0% > > Version 2 90,3% > > Version 3 72,7% > > Version 4 70,2% > > > > ---------------------------------------------------------------- > > Actually version 3 and version 4 are exactly equivalent for > Ruby, it parses them both as NODE_IF: Well, _finally_ the AST is the same. But somehow, it's slower... Maybe the translation from source/syntax to AST is slower? The numbers don't lie. They are averages of 3 test runs, with a standard deviation of almost zero. (see below for the full results.) Oh, by the way, but you've probably already figured it out: The number is the percentage of time Version 1 needed to complete. gegroet, Erik V. - http://www.erikveen.dds.nl/ ---------------------------------------------------------------- VERSION PERC AVE RUN1 RUN2 RUN3 DESCRIPTION Version 1 100,0% 10,154 10,174 10,214 10,181 if..elsif..else..end Version 2 90,3% 9,183 9,236 9,173 9,197 case..when..when..else..end Version 3 72,7% 7,360 7,390 7,440 7,397 if..else..end Version 4 70,2% 7,110 7,170 7,160 7,147 ..?..:.. Version 5 195,6% 19,868 20,068 19,808 19,915 lambda with ..?..:.. ----------------------------------------------------------------