From: Jeff King Date: Fri, 02 Jan 2026 06:16:27 GMT Subject: Re: [PATCH 1/1] compat: modernize and simplify byte swapping functions Message-ID: <20260102061626.GA2581074@coredump.intra.peff.net> In-Reply-To: <20260102002735.31390-2-rostiprodev@gmail.com> On Fri, Jan 02, 2026 at 02:27:35AM +0200, Rostislav Krasny wrote: > Replace manual bit operations with memcpy + network functions for better > maintainability. Add missing 16-bit network byte order conversion. This is burying the lede a bit, as they say. I don't know that the maintainability is much changed, especially as these are not functions that anybody looks at or touches very often. But this part might be compelling: > - Performance improvements (GCC 15.2.1, Clang 21.1.7): > * on x86-64 with -O0 4.2x faster (GCC), 3.7x faster (Clang) > * on x86-64 with -O1 4x faster (GCC), identical (Clang) > * on x86-64 with -O2 identical (GCC), 1.8x faster (Clang) The -O0 numbers are IMHO not very interesting (and are entirely expected; you are comparing optimized library memcpy versus unoptimized assignments). But clang making -O2 faster is quite interesting. If we are going to do this, I think it would be for the improved performance. And it would be nice for the commit message to go into details about what was measured and how. I'll respond elsewhere in the thread with some more thoughts. -Peff