Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.20.1603050906560.31711@monopod.intra.ispras.ru>
Date: Sat, 5 Mar 2016 09:14:57 +0300 (MSK)
From: Alexander Monakov <amonakov@...ras.ru>
To: musl@...ts.openwall.com
Subject: Re: [RFC PATCH] micro-optimize __procfdname

On Sat, 5 Mar 2016, Rich Felker wrote:
> > make it really obvious that __procfdname_impl fills in reverse; it might be a
> > very minor size optimization. I don't mind dropping this add adjusting buf
> > with '+= procfdbufsize - 1' in the callee.
> 
> Yes, making it obvious what's going on is nice too.

I'm going to keep that adjustment in the macro for now, then.

> Actually it would be even nicer if we could use a compound literal
> inside the macro as the buffer, but that would pessimize with
> unnecessary initialization and eliminate a lot of the code-size
> benefit, I think.

Yep, I did consider that and arrived to a similar conclusion. Well, there's an
option of using alloca as long as no use is in a loop, but that's a bit uglier,
and as I recall it wasn't optimized to a static stack allocation.

I forgot to ask before, shouldn't __procfdname_impl have a visibility
annotation?

And likewise for other internal functions.  There are some internal functions
without hidden/internal visibility annotation, visible outside of libc.so.
That seems unintended and slightly harmful.

Alexander

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.