Subject: Re: kern/1515 - Changing netstat variables to 64 bit
To: Christos Zoulas <christos@zoulas.com>
From: Lennart Augustsson <lennart@augustsson.net>
List: tech-net
Date: 06/09/1999 10:26:42
Christos Zoulas wrote:
> On Jun 9, 8:33am, lennart@augustsson.net (Lennart Augustsson) wrote:
> -- Subject: Re: kern/1515 - Changing netstat variables to 64 bit
>
> | Indeed, going from 32 to 64 bit counters should add one or two instructions
> | every time you increase the counter (add to the accumulator). I don't see
> | how that can suck performance so badly.
> |
>
> It is not just two instructions, look in adddi3.c. Yes, on a pentium class
> machine this might not matter, but it surely does on an ss2 or any m68k
> boxes, when those instructions end up in the critical loops.
As far as I can tell, gcc open-codes adddi3 on the following machines:
a29k alpha arc arm clipper convex elxsi i370 i386 i860 m32r m68k m88k mips
ns32k pa pyr romp rs6000 sh sparc vax we32k
I've just checked, on i386 it costs 2 instructions and on a sparc 1 instruction.
I don't have a m68k to try it on, but I would be surprised if it was more than
2 instructions.
So I still claim the cost is small, because I don't think these variables are updated
in an inner loop anywhere.
-- Lennart