TIP: Click on subject to list as thread! ANSI
echo: delphi
to: BART BROERSMA
from: GARY WEINFURTHER
date: 1997-10-27 09:01:00
subject: ASM in D2

Bart Broersma mentioned this to All:
 BB> None of my old assembly string handling routines (upstring, 
omparestring
 BB> etc) will work under D2/W95.
 BB> As these routines are/were much faster than standard pascal/D1 routines,
 BB> I'd like them back!
Almost all of the built-in string handling routines in Delphi are already 
written in assembler.  And the amount of miniscule nanoseconds that you might 
save by coding your own assembler routines will be more than offset by the 
amount of time and money you spend coding them.  I've done my own assembler 
optimization and timings on Delphi 2 and 3, and I found out the following 
things:
1. In many cases, Delphi's own routines are as fast as you can get.
2. In the cases where they're not, the amount of speed-up you get by 
hand-coding assembler is so small as to be insignificant to the application 
and the user.  For example, I was able to speed up a string search so that in 
100,000 iterations of the routine, mine was 100 milliseconds faster.  In one 
iteration, which is what normally occurs in an application, the difference 
would be undetectable, even by a timing routine.
3. My time (and $) was better spent on improving functionality, not speed.
4. Careful reading of the Object Pascal Language Reference will give you tips 
on how to optimize your code without resorting to assembler.  For example, 
use of the "const" parameter passing convention.  And by default, Delphi 
already passes as many parameters as it can by register.
5. When I used Borland C++, I loved to hand-code assembler routines.  With 
Delphi, it's not worth it.
With that said, if you still want to spend your time hand-coding assembler, 
you need to become familiar with 386/486 and Pentium protected mode 
assembler. It's different from old 8086 assembler in several ways.  For 
example, the segment registers aren't used in the same way, and you need to 
use the 32-bit registers EAX, EBX, ECX, EDX, etc., instead of the old 16 bit 
ones.
Don't forget also to read the Object Pascal Language Reference for tips on 
how registers are used and which ones need to be preserved.
                                ...Gary
--- GoldED 2.41
---------------
* Origin: Nobody expects the Flying Circus BBS! (1:2410/905)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.