[PATCH 0/5] IP checksum improvements
mj at ucw.cz
Tue Apr 27 09:47:36 CEST 2010
> > Huh, what should do endianity have in common with the choice of pre-/postincrement?
> Because most archs that can deal with preinc. are big endian, the
> for loop is important too. Decrement and test for zero is basically free.
If GCC generates obviously suboptimal code on some platform, fix GCC or at
least file a bug report. Trying to outwit the compiler by re-arranging the
source code in various magical ways can work only with specific combinations
of compiler + version + platform, so your code will need constant monitoring
and updating as the compilers evolve, which is a maintenance disaster.
If this function is a real hot spot, let us code it in assembly for the
platforms on which GCC does not do a good job. But only if a profile shows
that the checksumming functions are a real hot spot. Otherwise let's keep
the code simple and straightforward.
So before suggesting more changes, please show us the profile.
Have a nice fortnight
Martin `MJ' Mares <mj at ucw.cz> http://mj.ucw.cz/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
More information about the Bird-users