BurntSushi / xgbutil

A utility library to make use of the X Go Binding easier. (Implements EWMH and ICCCM specs, key binding support, etc.)
Do What The F*ck You Want To Public License
194 stars 46 forks source link

Improved performance of XPaintRects #31

Closed aarzilli closed 9 years ago

aarzilli commented 9 years ago

xgraphics.Image.xdraw (called by XPaintRects) has rather poor performance when called on a subimage.

Without any change I can get it to push ~37'000'000 pixel/second. Just swapping the x and y indexes on the loop that copies to the data buffer I can get to ~60'000'000 pixel/second. With the change in this commit, that calls copy on whole rows xdraw will push ~197'000'000 pixel/second, a 5x improvement on the original.

BurntSushi commented 9 years ago

Sweet! Looks great.