• Cherry Zhang's avatar
    runtime: use native CAS and memory barrier on ARMv7 · 150b7286
    Cherry Zhang authored
    This gets us around the kernel helpers on ARMv7.
    
    It is slightly faster than using the kernel helper.
    
    name           old time/op  new time/op  delta
    AtomicLoad-4   72.5ns ± 0%  69.5ns ± 0%  -4.08%  (p=0.000 n=9+9)
    AtomicStore-4  57.6ns ± 1%  54.4ns ± 0%  -5.58%  (p=0.000 n=10+9)
    [Geo mean]     64.6ns       61.5ns       -4.83%
    
    If performance is really critical, we can even do compiler intrinsics
    on GOARM=7.
    
    Fixes #23792.
    
    Change-Id: I36497d880890b26bdf01e048b542bd5fd7b17d23
    Reviewed-on: https://go-review.googlesource.com/94076
    Run-TryBot: Cherry Zhang <cherryyz@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarAustin Clements <austin@google.com>
    150b7286
bench_test.go 750 Bytes