[Gimp-developer] [PATCH 1/4] Tile caching performance patches
Sven Neumann
sven at gimp.org
Tue Jun 2 13:46:51 PDT 2009
Hi,
first of all thanks a lot for providing these patches. I definitely want
to get them merged as soon as possible. But there are a few minor issues
that should be discussed first. So let me start by commenting on your
first patch:
On Tue, 2009-06-02 at 04:11 -0400, Christopher Montgomery wrote:
> #define TILE_DATA_POINTER(tile,x,y) \
> ((tile)->data + \
> - (((y) % TILE_HEIGHT) * (tile)->ewidth + ((x) % TILE_WIDTH)) *
> (tile)->bpp)
> -
> + (((y) & (TILE_HEIGHT-1)) * (tile)->ewidth + ((x) &
> (TILE_WIDTH-1))) * (tile)->bpp)
As far as I know pretty much any compiler out there should be able to
replace a modulo by a power-of-2 constant by the bit-wise AND operation
without us explicitly doing so (see also
http://en.wikipedia.org/wiki/Modulo_operation#Performance_issues). So
for the benefit of readable code I suggest that we keep the code as it
is.
Sven
More information about the Gimp-developer
mailing list