![]() |
|
Bitmap filter |
SiegeLord
Member #7,827
October 2006
![]() |
Through the analysis of my code I determined that the following is the slowest part of one of my algorithms:
Removing the statement A makes the code run 10x faster. Am I doing this correctly? Both bitmaps are memory bitmaps. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
kazzmir
Member #1,786
December 2001
![]() |
Have you tried compiling your code with -O2 or whatever optimizations your compiler uses? If accessing memory slows your code way down this may not help much, but then nothing would I suppose. |
Kris Asick
Member #1,424
July 2001
|
Well, consider that you're allocating memory for a new bitmap every time you run this routine, and you're calling fn() twice for every pixel. Depending on what fn() does, that might be what's holding it up. But the bitmap allocation could be slowing it down too. If you could describe the effect you're trying to achieve we might be able to come up with an alternate method of doing it that would be faster. --- Kris Asick (Gemini) --- Kris Asick (Gemini) |
SiegeLord
Member #7,827
October 2006
![]() |
Well, this is sort of embarrassing... Indeed the equalization does not take any time at all, and the bottle neck actually occurs in the fn function... Apparently, when I remove the equalization statement(marked A in the code) the optimization routine of the compiler removes the calls of the fn(), thus leading me to believe that it was actually the equalization that was at fault. I discovered this by manually removing the calls to the fn and then testing whether the removal of the equalization did anything... It did not. The fn indeed needs to be optimized, but that is a question for another time. Thanks... "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
|