SRL Archive - Help and Support

color finding taking a thousand years to execute


riwu

2012-11-13 01:39:28

This color finding function, for some reason, is taking wayyy too long to execute (> 1min!).

//HueMod, SatMod, Col, Tol
ColInfo:=[TVariantArray([0.20, 0.07, 5987935, 20]),
TVariantArray([0.39, 1.14, 6842467, 15])];

SetLength(ATPA, Length(ColInfo));
ColorToleranceSpeed(2);

for i:=0 to High(ColInfo) do
begin
SetColorSpeed2Modifiers(ColInfo[i][0], ColInfo[i][1]);
FindColorsTolerance(ATPA[i], ColInfo[i][2], MSX1,MSY1,MSX2,MSY2,ColInfo[i][3]);
end;

ColorToleranceSpeed(1);

MergeATPAWrap(ATPA, TPA);
SplitTPAWrap(TPA, 8, ATPA);

EDIT: I realize it's not the color finding, but
SplitTPAWrap(TPA, 8, ATPA);
that is taking very long
, anyway to make it faster?

EDIT2: Replacing SplitTPAWrap with FloodFillTPA solves the problem.
But i don't feel secure using it without a full understanding of how FloodFillTPA works. Also it doesn't have a wrapper function so would it cause memory leak?

It may be due to the extensive amount of color i'm gathering:

Le Jingle

2012-11-13 02:22:06

MasterBB says that Simba functions have potential to cause memory links from another thread you made here. or: here - so theoretically, as long as your function doesn't return an array type you should be ok? Perhaps, as I read through other posts, dividing up your processes with arrays into separate wrapper functions may help improve speed.

Cheers,
Lj!

riwu

2012-11-13 02:33:52

From: Le Jingle
MasterBB says that Simba functions have potential to cause memory links from another thread you made here. or: here - so theoretically, as long as your function doesn't return an array type you should be ok? Perhaps, as I read through other posts, dividing up your processes with arrays into separate wrapper functions may help improve speed.

Cheers,
Lj!

FloodFillTPA returns an ATPA, something like TPAToATPA, so it should require a wrapper. (and there isn't one)

The main problem here is that i've an excessive amount of TPA, hence it takes SplitTPA forever to group them. I can't use TPAToATPA because it may end up grouping wrong things together. I'm now reading the FloodFillTPA code, a bit terrifying :S

EDIT:
FloodFillTPA definitely needs a wrapper! Simba RAM flooded to over 400 MB within 10min -.-