Clear big AAs
useo
useo6 at start.bg
Sun Jun 12 23:46:08 PDT 2011
> useo:
> > Is there anything I forgot to consider?
> If the key and values are primitive values or structs of primitive
values then you may try another AA implementation that doesn't use
the GC.
> Bye,
> bearophile
I tried some different implementations and I also reduced the size of
my arrays without any success :(. It always drops down to 1 FPS for 1
second and after that it runs for some seconds normal until next 1
FPS-second.
I also tried to do the work within a separate thread, also without
success. My current code looks like:
toRender.clear();
toRender = null;
for (int y = pFromY; y < pToY && y < pTiles.length; y++) {
for (int x = pFromX; x < pToX && x < pTiles[y].length; x++) {
toRender[pTiles[y][x].texture] ~= pTiles[y][x];
}
}
toRender is my AA which contains the textures as key (instances of my
class "Texture") and the tiles (position of them) as values. When I
remove the first two lines (clear and set null) it doesn't drops down
to 1 FPS, it runs normal.
I hope anyone know a solution :)
More information about the Digitalmars-d-learn
mailing list