Re: I need the fastest routine
- From: Clément Doss <cdoss@xxxxxxxxxx>
- Date: Sat, 05 Jul 2008 15:51:45 -0300
I doubt it! Usually when programmers are looking for the fastest execution of a small part of their program,
their are looking in the wrong place to speed up the
This routine is called a lot of times. In fact it's a part of a bigger project. I don't know exactly how to explain it in English, but I'll try anyway.
My team must maintain an interface that will diagnose a hardware, in fact, we are taking over a project that had some problems with the older team.
Anyway, while connected with the hardware, we read some data. Most of them are arrays of double. More precisely "up" to a triplets of doubles.
The specification isn't clear about how large the arrays are. I guess they depend on the hardware model. I've logged over +5000 elements in a single array. The values are not "very big" nor very precise (up to 5 decimals). During the diagnostic, the routines check for inconsistencies. Depending on the array position, we can call a more specific diagnostic that will give us another array to check and so on.
We are not allowed to order the original array because we need to keep the index exactly at the original position. I still have a lot of things to digest, and I just haven't all the required time.
So far we managed to improve a lot over the older routines. The doubles can be converted to integer (not even int64). There are a lot of functions doing operations on those arrays. Most of them were declared like /somefunc(V:array of double)/ . Just by redeclaring them to /somefunc( const V: array of double )/ helped a lot.
One of the most time consuming routines is the minmax functions. The time use to convert the array to integer, and extract the minmax is a fraction of the time the older routine used. I used the routine I posted here. Even the manager noticed the improvement (WOW!!).
There's another procedure building a matrix, and doing some operations. Still haven't got the time to check what operations exactly. But the declaration is also all wrong. And I think I can improve the algorithm too. I must study better before doing those changes.
That's why I posted in this newsgroup. I just want to be sure that the routine is as fast as it can get.
Time to drink some coffee and read some more specs!