[Dev-C++] Optimizing C code, what is best??
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Zodiaq <zo...@ac...> - 2003-05-30 15:16:30
|
Hello All Dev-cpp-users,
there is one function in my program that needs some optimization...
the problem is about computing distance between parts of two
vectors... currently it is done like this:
DWORD64 computeDistance( short *src, const WORD &wRow, const WORD
&wColFrom, const WORD &wColTo ) const
{
DWORD dwDist = 0;
INT iA;
short *sP = sData[ wRow ];
for( WORD wCol = wColFrom; wCol <= wColTo; ++wCol )
{
iA = src[ wCol ] - sP[ wCol ];
dwDist += iA * iA;
}
return dwDist;
}
src is element I want to compute distance from specified element of
big array of rows... gprof shows that this function takes over 90% of
total program time...
well, I know it is not about DevC++, but since I made progs under it
and this is quite simple problem, I hope that someone can and will
help me...
The best solution for me would be ASM code optimized for AMD Athlon
processor (for my computer, which as only one will run this code). For
someone with good knowledge of ASM this is only few moments, and for
me great deal of work - I don't know ASM a bit... so please someone
help me... thank you in advance!
--
regards, Zodiaq...
|