• Nigel Tao's avatar
    image/draw: optimize drawFillOver as drawFillSrc for opaque fills. · f782a7e0
    Nigel Tao authored
    Benchmarks are much better for opaque fills and slightly worse on non
    opaque fills. I think that on balance, this is still a win.
    
    When the source is uniform(color.RGBA{0x11, 0x22, 0x33, 0xff}):
    name        old time/op  new time/op  delta
    FillOver-8   966µs ± 1%    32µs ± 1%  -96.67%  (p=0.000 n=10+10)
    FillSrc-8   32.4µs ± 1%  32.2µs ± 1%     ~      (p=0.053 n=9+10)
    
    When the source is uniform(color.RGBA{0x11, 0x22, 0x33, 0x44}):
    name        old time/op  new time/op  delta
    FillOver-8   962µs ± 0%  1018µs ± 0%  +5.85%   (p=0.000 n=9+10)
    FillSrc-8   32.2µs ± 1%  32.1µs ± 0%    ~     (p=0.148 n=10+10)
    
    Change-Id: I52ec6d5fcd0fbc6710cef0e973a21ee7827c0dd9
    Reviewed-on: https://go-review.googlesource.com/28790Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
    f782a7e0
bench_test.go 6.15 KB