Re: Performance patch for NE Ethernet

Marc Lehmann (
Fri, 14 Feb 1997 00:33:06 +0100 (MET)

>> Umm, adding extra sets of "( ... )" doesn't gain anything other than
>> making it more work for me to read through the patch to see what you
>> are trying to change. There are lots of these in this patch...
>NE_BASE is a MACRO (#define), ENO_ISR is a MACRO (#define). inb_p() is
>a MACRO that defines a compiler-specific "inline function".
>We are _required_ to use parenthesis around concatenated macros and
>parameters passed to macros to guarantee that the code you specify

Not at all... a macro that forces its user to add these parentheses
is miscoded. Wether the macro-writer was sloppy or wether he had
to code it this way because the compiler (NOT gcc) demanded this
is a different question.

As long as you use gcc, you will NEVER need to code a macro that
NEEDS extra parentheses.

>> > - outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, nic_base+ NE_CMD);
>>> > + outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, (NE_BASE + NE_CMD));
>> brackets... NE_BASE macro vs. nic_base will be obscured by GCC.
>nic_base was an extra operation. Read the code.
>On line 622 there is even "int nic_base = NE_BASE"

Well, then NE_BASE should be even slower, since it uses an indirection
(dev->...). In reality, the code is the same, well, nic_base could be even
faster, because its local.

> The output routine is also shortened AND made clearer. You can't just
> look at a patch to determine its validity.

In theory, you could - in practise, well, one might overlook
that functions become shorter, but you can judge
from your patch that there was nothing that really got improved..
brackets DON'T make your code faster, and too much brackets
don't make it clearer, too.

the change from nic_base to NE_BASE may be a clarification,
but at least on an optimizing compiler, the code
will not become faster, at most somewhat slower, but
with gcc, the code should be identical.


for a pentium-optimizing gcc, look at

----==-- _
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ /
-=====/_/_//_/\_,_/ /_/\_\
The choice of a GNU generation