| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Squares |
Hi Darin.
13-Apr-04 17:01:46, Darin McBride wrote to Jasen Betts
DM> Hello Jasen!
DM> Replying to a message of Jasen Betts to Neil Heller:
NH>>> that I would consider it only natural that any optimizing
NH>>> compiler would do what you did, only automatically. Is this the
NH>>> case? Or should I be concerned with optimizing manually - not
NH>>> trusting the compiler manufacturer?
JB>> The compiler doesn't understand strlen.
DM> ;-) Most modern compilers probably do understand strlen. For
DM> example, I believe Pentiums have a single hardware instruction
DM> that performs the strlen function much faster than software can
DM> emulate, so you'll end up with something that looks like a
DM> function call becoming pure assembly ;-
dunno about pentium but in 8086..
les di,somepointer
mov cx,0
mov al,0
repz scasb ;// most of the work is done here.
mov ax,cx
works line strlen
you can't really make it part of the compiler,
but you could make it an inline in string.h
maybe it could be part of the compier that's only active if the compuiler
reads something in string.h
JB>> for( s=target ; *s ; s++ ) {
DM> Yes, I like this even more ;-)
so do most compilers, pointers are faster than arrays :)
-=> Bye <=-
---
* Origin: I'm pink, therefore I'm SPAM. (3:640/1042)SEEN-BY: 633/267 270 @PATH: 640/1042 531 954 774/605 123/500 106/2000 633/267 |
|
| 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™.