]> Cypherpunks repositories - gostls13.git/commit
image/draw: optimize out some bounds checks.
authorNigel Tao <nigeltao@golang.org>
Mon, 31 Aug 2015 03:38:13 +0000 (13:38 +1000)
committerNigel Tao <nigeltao@golang.org>
Tue, 1 Sep 2015 00:34:26 +0000 (00:34 +0000)
commite424d5968006167d5c99b3b9959e61950aa50cf8
tree991b791d9c143f21fb495069e3ec231d4a8ab367
parent754d4c052aa297ac5923d31924c882196ba0d0b2
image/draw: optimize out some bounds checks.

We could undoubtedly squeeze even more out of these loops, and in the
long term, a better compiler would be smarter with bounds checks, but in
the short term, this small change is an easy win.

benchmark                      old ns/op     new ns/op     delta
BenchmarkFillOver-8            1619470       1323192       -18.29%
BenchmarkCopyOver-8            1129369       1062787       -5.90%
BenchmarkGlyphOver-8           420070        378608        -9.87%

On github.com/golang/freetype/truetype's BenchmarkDrawString:
benchmark                 old ns/op     new ns/op     delta
BenchmarkDrawString-8     9561435       8807019       -7.89%

Change-Id: Ib1c6271ac18bced85e0fb5ebf250dd57d7747e75
Reviewed-on: https://go-review.googlesource.com/14093
Reviewed-by: Rob Pike <r@golang.org>
src/image/draw/draw.go