| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | movsb |
Answering msg from Paul Edwards to Matthew Parker,
on Wednesday December 27 1995 at 12:56
PE> 002c 8a 01 L2 mov al,[ecx]
PE> 002e 88 02 mov [edx],al
PE> 0030 41 inc ecx
PE> 0031 42 inc edx
PE> 0032 3c 0a cmp al,0aH
PE> 0034 75 f6 jne L2
; Entry requirements:
; ESI = pointer to source (ECX above)
; EDI = pointer dest (EDX above)
push es ; save ES
push ds
pop es ; ES=DS
L2:
lodsb ; load AL from DS:[SI] then increment SI
stosb ; save AL to ES:[DI] then increment DI
cmp al,0ah
jne L2
pop es ; restore ES
PE> This code is what will be the bottleneck in any text processing
PE> applications using fgets() with PDPCLIB, and I was thinking it
PE> might be possible/better to use some assembler here, to use a
PE> MOVSB or something. If the average length of a text line that is
PE> processed by fgets is say 30 bytes, then this loop will be
PE> executed 30 times.
I don't think you'll see much of a speed improvement. On the old 8088s the
string commands such as LODSB, STOSB, MOVSB were much faster, but now
"hand rolling" them discretely as above can be just as fast,
sometimes faster.
PE> I was wondering if you had any feel for what would be best
PE> time-wise. This code is a C runtime library for OS/2 32-bit
PE> 80386 and above. The C runtime library, being of dire
PE> importance, can be as dirty as you can make it, so long as it's
PE> FAST FAST FAST! BFN. Paul.
Rethinking it with SCASB (scan for byte) then MOVSW/MOVSB might be a better idea.
---
* Origin: Jelly-Bean software development, Melbourne AUST. (3:635/727.1)SEEN-BY: 50/99 632/103 348 998 633/371 634/384 635/503 513 544 727 638/102 SEEN-BY: 639/252 640/230 690/718 711/401 410 413 430 808 809 934 713/888 SEEN-BY: 800/1 7877/2809 @PATH: 635/727 632/348 635/503 50/99 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
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™.