lwip-devel
[Top][All Lists]
Advanced

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

RE: [lwip-devel] byte order, packing, optimizations


From: Bill Auerbach
Subject: RE: [lwip-devel] byte order, packing, optimizations
Date: Mon, 15 Feb 2010 09:01:41 -0500

>Yeah, that could be improved, but I'm an opponent of adding warnings
>where we only give a hint to optimization: the code as it is works
>perfectly well - on platforms where performance isn't the main goal,
>there's no need to issue a warning! Also, not everyone has the
>possibility to generate a LWIP_PLATFORM_BYTESWAP macro that is really
>faster than the default C code we have.

A compiler that supports inline assembler may still be able to improve on
htonl and htons.

On 8-bit systems which need the improvement the most, I've never seen a
compiler implement htonl as a pair of register swaps.

>I'm OK with that. But people shouldn't rely on that as it's a very
>crucial function regarding performance and on most platforms can be
>improved by writing an assembler version.

How about a contrib folder asm_chksum and take contributions with consistent
file and function namings:

arm_inet_chksum in arm_inet_chksum.c
z80_inet_chksum in z80_inet_chksum.c
ppc_inet_chksum
niosii_inet_chksum

and so on....  Some may not be completely compiler portable, but it's far
easier to solve that than come up with one from scratch.  Very few people
know assembler and even fewer want to learn it.  As this is the number one
optimization one can make, why not make it easier on the user to add?

Bill






reply via email to

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