[Gllug] code optimisations

Nix nix at esperi.org.uk
Tue Mar 22 10:42:12 UTC 2005


On Mon, 21 Mar 2005, Pete Ryland uttered the following:
> And by Cache efficiency, I mean things like organising memory usage to be
> more sequencial if possible, e.g.:
> 
> for (i=0; i<1000000; i++)
>   for (j=1; j<10000000; j++)
>     a[i][j]++;
> 
> is *significantly* faster than:
> 
> for (j=1; j<10000000; j++)
>   for (i=0; i<1000000; i++)
>     a[i][j]++;
> 
> I don't think a compiler would optimise that type of thing.

Optimizations that can do that sort of code motion in some cases are on
the cards for GCC-4.1. :)

-- 
> ...Hires Root Beer...
What we need these days is a stable, fast, anti-aliased root beer
with dynamic shading. Not that you can let just anybody have root.
 --- John M. Ford
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list