From: Miguel Angel (maacruz@navegalia.com)
Date: Thu May 04 2000 - 22:23:46 CEST
On Wed, 03 May 2000, Alfie Costa kindly wrote:
> On 28 Apr 2000, at 17:58, Miguel Angel <mulinux@sunsite.auc.dk> wrote:
> 
> > To notice such subtle difference (if there is any at all) is better to write the
> > loop repeating many times the inner sentences (unless you are also testing the
> > loop).          
> 
> OK, I have tried this.  I defined the code like so:
> 
> #define C1 line[j]=z;n=line[j];j++;line[j]=y;n=line[j];j--; 
> #define C2 *l=z;n=*l++;*l=y;n=*l--;
> 
> ...then inserted about about 150 'C1's and 'C2's in each loop.  The result was 
> that the loop with the pointers really did turn out to be faster, around 30-50% 
> if I recall correctly -- whatever the exact figure was, the pointers were 
> always faster. The code was tested with 'gcc', I haven't tried that old Turbo C 
> compiler yet.
>  
> Naturally this was a surprise, given the previous confusing results which used 
> much more loop overhead.  Thanks again for suggesting this.
> 
Ok. So using pointers is faster. But I still have to recommend to use pointers
only when this is a real advantage against clarity (i'm very pascalized :-))
--
Don't see the world trought a window, be open{source}minded, and be free :-)
http://www.navegalia.com/personal/maacruz
---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: mulinux-help@sunsite.auc.dk
This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:14 CET