This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Single threaded stdio optimization


On Fri, 2017-06-30 at 15:34 +0000, Wilco Dijkstra wrote:
> Torvald wrote:
> >
> > What's interesting here is that your high-level optimization is faster
> > than doing the single-thread check in the low-level lock (x86 has it
> > already in the low-level lock).
> 
> Have you ever looked at the generated code for eg. getc?
> Each lock does a lot of work even with the low level lock bypass
> optimization. It still does several branches, reads and writes, and
> this is repeated twice for the lock and unlock. A single branch bypassing
> all that is obviously going to be much faster...
> 
> And interestingly when you remove the low level lock optimization,
> multithreaded code will run faster too as it no longer needs to do the
> extra checks for the single-threaded case.

I have always argued that we should do this kind of optimization in the
clients, so at the higher levels.  So we are in agreement here :)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]