• Keith Randall's avatar
    cmd/compile: intrinsics for math/bits.{Len,LeadingZeros} · 495b1679
    Keith Randall authored
    name              old time/op  new time/op  delta
    LeadingZeros-4    2.00ns ± 0%  1.34ns ± 1%  -33.02%  (p=0.000 n=8+10)
    LeadingZeros16-4  1.62ns ± 0%  1.57ns ± 0%   -3.09%  (p=0.001 n=8+9)
    LeadingZeros32-4  2.14ns ± 0%  1.48ns ± 0%  -30.84%  (p=0.002 n=8+10)
    LeadingZeros64-4  2.06ns ± 1%  1.33ns ± 0%  -35.08%  (p=0.000 n=8+8)
    
    8-bit args is a special case - the Go code is really fast because
    it is just a single table lookup.  So I've disabled that for now.
    Intrinsics were actually slower:
    LeadingZeros8-4   1.22ns ± 3%  1.58ns ± 1%  +29.56%  (p=0.000 n=10+10)
    
    Update #18616
    
    Change-Id: Ia9c289b9ba59c583ea64060470315fd637e814cf
    Reviewed-on: https://go-review.googlesource.com/38311
    Run-TryBot: Keith Randall <khr@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
    495b1679
inl.go 26.5 KB