Rob Kennedy wrote: > The name of that unit suggests it's a unit written for the Intel 80387 > math coprocessor; is it really that old? > I don't know. There was no source code, only a DCU. But it is for Delphi. I have found also a library (with the same name) which is for Pascal :) > Being written in assembler and performing the same as the function in the > Math unit aren't mutually exclusive things. > The DCU was offered as a faster replacement for Borland functions. It didn't performed much better. Indeed this doesn't mean that the code was not written in ASM. Anyway I never said that it wasn't made in ASM. I just said that the speed of that DCU was similar with Borland's. Usually ones expect at least a 2x speed improvement from an ASM code (also a 5x speed improvement is not exaggerated). > For one hundred million things, that seems pretty fast already. How fast > do you want it go instead? > The speed of my code (2 sec) is ok but there are also other pieces of code in that loop, so the total time for the whole the loop can go up to 10-30 seconds. Anyway I got a piece of code in ASM from Wilfried (thanks again Wilfried) which is about 2-3 times faster than my plain Delphi code. Yesterday I spend the whole day optimizing that loop and I decreased the time with about 50-55%. Is still unacceptable since I have lot of data to process.
I have only minor understanding of ASM (enough to understand ASM code but not enough to write) so I am thinking seriously in learning more ASM. > That executes two comparisons and a maximum of three assignments. > > function Max(const A, B, C: Integer): Integer; > begin > if A > B then > if A > C then > Result := A > else > Result := C > else > if B > C then > Result := B > else > Result := C; > end; > > That executes two comparisons and a maximum of one assignment. > > Great! Sure it will execute faster than mine. Indeed it will execute comparisons to get the final result. Thank you very much. It is funny how a piece of code can get faster by using more lines of code :) _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

