[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RE: [lwip-users] IP Address Display Functions
From: |
Simon Goldschmidt |
Subject: |
Re: RE: [lwip-users] IP Address Display Functions |
Date: |
Thu, 03 Sep 2009 14:15:48 +0200 |
> > Also, I see a *huge* difference in performance with packing by 2 versus
> 1
> > which we do in many if not all ports.
>
> I find it interesting that this makes a difference.
Why? I think that's pretty good to explain: All the network protocols we use
packing for would require 2-byte-packing only, not 1-byte-packing (unless I'm
wrong here). The result of 2-byte-packing is that the compiler may read 16-bit
words instead of bytes which results in half the number of read accesses on
16-bit-or-more platforms.
Of course, this only works if we never include (unaligned) byte members in
structs - we're pretty much. But as most of the protocol headers are multiples
of 2 or 4, this might work.
> I.e. it sounds to me like your compiler is
> reading more into packed directives than it needs to (perhaps to make
> things simpler for it): it is affecting both the packing of the
> structure and the way it accesses the fields in that structure.
How would it differ between the two? It would have to know how the data is
aligned at compile time, which it can't??
Simon
--
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02