diff options
author | Rich Felker <dalias@aerifal.cx> | 2018-10-18 12:47:26 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018-10-18 13:09:33 -0400 |
commit | 9dd19122565c70bc6e0fff35724c91a61209a629 (patch) | |
tree | 272f42ab2c781e3663063779ab4a2e338fdd147a /src/linux/arch_prctl.c | |
parent | 7eda27d025d6d52f855588590366c83d737eb727 (diff) | |
download | musl-9dd19122565c70bc6e0fff35724c91a61209a629.tar.gz musl-9dd19122565c70bc6e0fff35724c91a61209a629.tar.bz2 musl-9dd19122565c70bc6e0fff35724c91a61209a629.tar.xz musl-9dd19122565c70bc6e0fff35724c91a61209a629.zip |
further optimize getc/putc when locking is needed
check whether the lock is free before loading the calling thread's
tid. if so, just use a dummy tid value that cannot compare equal to
any actual thread id (because it's one bit wider). this also avoids
the need to save the tid and pass it to locking_getc or locking_putc,
reducing register pressure.
this change might slightly hurt the case where the caller already
holds the lock, but it does not affect the single-threaded case, and
may significantly improve the multi-threaded case, especially on archs
where loading the thread pointer is disproportionately expensive like
early mips and arm ISA levels. but even on i386 it helps, at least on
some machines; I measured roughly a 10-15% improvement.
Diffstat (limited to 'src/linux/arch_prctl.c')
0 files changed, 0 insertions, 0 deletions