avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] poor optimisation


From: Joerg Wunsch
Subject: Re: [avr-libc-dev] poor optimisation
Date: Tue, 19 Nov 2002 15:57:43 +0100
User-agent: Mutt/1.2.5i

As Rob Ward wrote:

> 1. Using you 'loop code' would almost definitely make the generated
> code smaller, however in this case speed is most important. The way
> I have written the code has in fact saved about 13 microseconds
> within the ISR.  This is important in this application.

OK, that's justification enough, of course.  I have once written a
floppy driver on a 2.5 MHz Z80 where i could not afford to add a
counter for up to 4 * 256 bytes, and instead had to concatenate the
code four times (using an assembler macro) to read each 256 bytes from
the floppy, since the additional counter would have required a stack
push/pop operation which had caused the loop to go beyond the 16 µs
limit imposed by the floppy drive...

> 
> 2. A faster / better version could be...
> 
>   SetDataLow(); if (DataHigh & 0x80) SetDataHigh(); SetClockHigh(); 
> SetClockLow();

This seems so, yes.

As usual: it's always good to try some variants and look at the
generated assembler code if speed is important.

-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]