Re: [PATCH v2] libuuid: improve uuid_unparse() performance

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

 



On Wed, Apr 01, 2020 at 06:34:06AM -0300, Peter Cordes wrote:
> On Wed, Apr 1, 2020 at 5:31 AM Karel Zak <kzak@xxxxxxxxxx> wrote:
> >
> > On Thu, Mar 26, 2020 at 03:38:27PM +0100, Aurelien LAJOIE wrote:
> > > +     __attribute__((alias("uuid_unparse_upper")));
> > > +#else
> > > +void uuid_unparse(const uuid_t uu, char *out)
> > > +     __attribute__((alias("uuid_unparse_lower")));
> > > +#endif
> >
> > The alias attribute is not portable to clang on Darwin.
> >
> >  https://travis-ci.org/github/karelzak/util-linux/jobs/669244356?utm_medium=notification&utm_source=email
> >
> > I have replaced the aliases with function calls.
> >
> >  https://github.com/karelzak/util-linux/commit/bee464006776203a8cb545a35c86234181c7a55a
> 
> Since Darwin does support weak_alias, can we just use that?  Is it
> "strong enough"?  I'm assuming nothing will override the alias so it
> can still have the same efficient end result, having both symbols
> resolve to the same address with no extra per-call overhead.  (And
> without bloating the library from a compiler deciding to inline the
> static helper function into all 3 instead of 2 callers.  Although most
> programs probably only ever call one, so only one has to stay hot in
> I-cache, with the others only bloating the file size and space in that
> iTLB memory page.)
> 
> Or can we put the wrapper function in a .h so it can inline away?
> That would bake the choice into applications that use libuuid, so you
> couldn't change it just by rebuilding libuuid.  That's perhaps not
> desirable; if applications wanted to have that choice baked in they
> could have called the explicit upper or lower versions.
 
 Frankly, what we're trying to fix by the alias? It sounds like
 premature optimization. The current solution works, maybe foo(bar())
 is also optimized by compiler. I have doubts that use inline function 
 in header or so makes a real sense.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux