This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH v2] Single threaded stdio optimization
- From: Torvald Riegel <triegel at redhat dot com>
- To: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- Cc: Szabolcs Nagy <Szabolcs dot Nagy at arm dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>, nd <nd at arm dot com>
- Date: Fri, 30 Jun 2017 18:03:23 +0200
- Subject: Re: [PATCH v2] Single threaded stdio optimization
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=triegel at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A48FC17E
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A48FC17E
- References: <AM5PR0802MB26101886575C9707508B1CFC83D30@AM5PR0802MB2610.eurprd08.prod.outlook.com>
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 :)