Re: Speed of global function
- Posted by Robert Craig <rds at RapidEuphoria.com> Aug 16, 2003
- 390 views
jxliv7 at hotmail.com wrote: > Rob, this doesn't make sense. > > execution time range in seconds with various iterations and elements > t = 3.02 30.65 17.03 copy of RDS code > s = 3.96 39.44 22.3 Ricardo's code > r = 2.3 22.9 12.65 RDS code > > Ricardo, the guy who wrote the original Test2 claimed that it > was sometimes faster than your global routine. > > i am thoroughly confused. can you help me see what's going on...? So you seem to be saying that the official reverse() in misc.e is the fastest, but you are concerned that a similar routine that you coded using different variables is quite a bit slower. You also found Ricardo Forno's reverse to be slower than the official one. I just tried your code on my Pentium-4 machine, and it showed Forno's routine to be the fastest (by 20% over the official), your rewritten reverse() to be 2nd fastest and the official one to be third fastest, although yours and the official one were very close. On my Pentium-2 under Linux I got essentially the same results, but the gap between fastest and slowest was narrow. A few years ago, on this list, we considered several different ways of doing reverse(), and I remember that the top contenders were pretty close, and sometimes the relative order varied from one machine to the next. I can't really explain it, but when you have small loops the modern Pentiums do some really sophisticated and unpredictable stuff to speed things up. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com