Hi,

On 2026-02-06T14:29:34+0100, Milan Straka wrote:
> Hi all,
> 
> > -----Original message-----
> > From: "Kevin J. McCarthy" <[email protected]>
> > Sent: 6 Feb 2026, 09:41
> >
> > On Thu, Feb 05, 2026 at 02:57:47AM +0100, Gero Treuner wrote:
> > > Out of curiosity I rewrote it to iterate over the three subdirectory
> > > names and compared the difference in size of the binaries. In this
> > > case it apparently is dominated by (debug) symbols and not hitting a
> > > threshold for reduced size of a fully stripped binary on my system.
> > > 
> > > So having done this anyway, I propose an optimization utilizing the
> > > uniform length of the names. (Further compacting the code saves more
> > > space but degrades readability of the logic.)
> > 
> > Thanks Gero!  I certainly agree it's more optimized. :D
> > 
> > However, I personally argue for code clarity except when optimization is
> > called for.  In this case, I don't think it's worth the trade off.  See just
> > below the function in mh.c, mx_is_mh(), for similar code, also called by
> > mx_get_magic().
> > 
> > As always, if others disagree please just say so.
> 
> personally I see it the same way, considering readability and simplicity
> a big priority; parsing the proposed version is (at least for me) much
> harder than the original version.

+1

Except that maybe with fstatat(2) (as Crystal said) it could be readable
--we'd have to see the code, though--.

readability >>> optimizations


Have a lovely day!
Alex

> 
> Cheers,
> Milan S.



-- 
<https://www.alejandro-colomar.es>

Attachment: signature.asc
Description: PGP signature

Reply via email to