Re: I need the fastest routine

Hi JohnH,

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
overall execution.

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!



Relevant Pages

  • Speed versus memory
    ... My initial impulse was to use vector processes everywhere. ... an absurd amount of memory. ... Such a routine only has two input arrays ... and one output array but goes through ten intermediate arrays all of ...
  • Re: CVF compiler question, program giving inconsistent results
    ... Run time error checking for "Array and string bounds" is turned on. ... There is no Monte Carlo stuff in this code. ... routine in a support library that generates a "random" ... Right after the LOGICAL INITS declaration there is ...
  • Re: Routine Interfering with Clipboard
    ... Otherwise use the temporary array, eg open one wb, assign the values ... file in created Inst2 that from its Open event starts a new routine called ... The macro therefore takes 25mins to run. ... instance of Excel and then open a second hidden instance to do all the ...
  • Re: Passing an array to a sub routine
    ... FileHandle, Array, Hash, Method, Regex}? ... The LoadDataFile routine works correctly, but the SaveDataFile ... > sub LoadDataFile ...
  • Re: A question about OOP in Fortran?
    ... routine that will work with any class. ... So you can declare a hash table with any base type. ... If you want a heterogenous collection (array, string, list, ...