> From: Gabriel Bouvigne [mailto:[EMAIL PROTECTED]] > > The following loop is faster than array, both on hppa > processors using g++, > pentium, celeron and pIII using both egcs and msvc++: > > for (i=len, p=(array+i); i--; ) > sum+=*--p; > > Descending loops with pointer use have always shown to be faster than > arrays. I use them a lot in image processing. Indexing in reverse order is a separate issue. When I compare your version with for (i = len; i--;) sum += array[i]; under both MSVC and gcc 2.95/i386, the array version is actually slightly faster. -- Mat. -- MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )
- Re: [MP3 ENCODER] toolame 01d (fwd) Patrick De Smet
- Re: [MP3 ENCODER] toolame 01d (fwd) Takehiro Tominaga
- Re: [MP3 ENCODER] toolame 01d (fwd) Richard A. Smith
- Re: [MP3 ENCODER] toolame 01d (fwd) Mathew Hendry
- Re: [MP3 ENCODER] toolame 01d (fwd) Gabriel Bouvigne
- Re: [MP3 ENCODER] toolame 01d (fw... Monty
- Re: [MP3 ENCODER] toolame 01... Gabriel Bouvigne
- Re: [MP3 ENCODER] toolame 01d (fw... Patrick De Smet
- Re: [MP3 ENCODER] toolame 01... Bill Eldridge
- Re: [MP3 ENCODER] toolame 01d (fwd) Mathew Hendry
- Re: [MP3 ENCODER] toolame 01d (fwd) Richard A. Smith
- Re: [MP3 ENCODER] toolame 01d (fwd) Gabriel Bouvigne
- [MP3 ENCODER] Optimization Techniques mikecheng
- Re: [MP3 ENCODER] Optimization Techni... Mathew Hendry
- Re: [MP3 ENCODER] Optimization Te... Patrick De Smet
- Re: [MP3 ENCODER] Optimizati... Gabriel Bouvigne
- [MP3 ENCODER] Documentat... mikecheng
- Re: [MP3 ENCODER] Do... Thomas Zimmerman
- Re: [MP3 ENCODER] Do... Lars Magne Ingebrigtsen
- Re: [MP3 ENCODER] Do... mikecheng