This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] Single threaded stdio optimization
On 29/06/17 15:06, Siddhesh Poyarekar wrote:
> On Thursday 29 June 2017 06:59 PM, Szabolcs Nagy wrote:
>> this does not do what we want:
>> single check + tailcall the unlocked version.
>>
>> with your code gcc is more likely to do two
>> checks and register spills and an additional
>> return.
>>
>> while my code does not force gcc to do the
>> right thing at least it shows the intent.
>
> Can you verify this both ways? If they don't show any noticeable
> difference then I prefer the way I suggested, but that is really just
> for aesthetics. Maybe also provide a __glibc_unlikely hint to aid the
> compiler.
your code layout does not work for most
io apis as they use _IO_acquire_lock/unlock
which create a new scope for cancel cleanup
handling.
it only works with non-cancellation point
apis (flag checks: feof, ferror) that just
flockfile/funlockfile.
i can change those two functions where it
works but i dont think it will be any more
maintainable.