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.
xgraphics.Image.xdraw
(called byXPaintRects
) 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 callscopy
on whole rowsxdraw
will push ~197'000'000 pixel/second, a 5x improvement on the original.