MUD-Dev
mailing list archive
[ Other Periods
| Other mailing lists
| Search
]
Date:
[ Previous
| Next
]
Thread:
[ Previous
| Next
]
Index:
[ Author
| Date
| Thread
]
RE: [MUD-Dev] Naming and Directories?
From: mud-dev-admin#kanga,nu [mailto:mud-dev-admin#kanga,nu]On Behalf Of
Chris Gray
> [Jo Dillon:]
> > If it's that optimised might it not be defined in the header file,
> >giving the compiler the source? I mean, if I was writing a highly
> >optimised strcmp I wouldn't overlook the overhead involved in a function
> >call...
Well, gcc doesn't. From gcc's info files, 2.7.2.1 (closest I had at hand):
`-fno-builtin'
Don't recognize builtin functions that do not begin with two
leading underscores. Currently, the functions affected include
`abort', `abs', `alloca', `cos', `exit', `fabs', `ffs', `labs',
`memcmp', `memcpy', `sin', `sqrt', `strcmp', `strcpy', and
`strlen'.
GCC normally generates special code to handle certain builtin
functions more efficiently; for instance, calls to `alloca' may
become single instructions that adjust the stack directly, and
calls to `memcpy' may become inline copy loops. The resulting
code is often both smaller and faster, but since the function
calls no longer appear as such, you cannot set a breakpoint on
those calls, nor can you change the behavior of the functions by
linking with a different library.
The `-ansi' option prevents `alloca' and `ffs' from being builtin
functions, since these functions do not have an ANSI standard
meaning.
> I don't know if has been (or can be) done with strcmp in particular,
> but I've heard of optimized versions of memcpy that have quite long
> sources, sometimes written in assembler. They attempt to do things
> whole words at a time instead of a character at a time, have special
> cases for short operations, etc. I may be a few years out of date on
> this info, however. Personally, I don't recall seeing any functions
> given in system header files like that, other than things like
> 'FD_SET', etc. Keep in mind that the practice of having short accessor
> routines be 'inline' is a C++ thing, and doesn't port to ANSI C (I think -
> I know gcc supports 'inline', but is it part of ANSI C?)
Aw, it ports well enough to C. If you define them as
static INLINE get_foo() { return foo; }
you can just -DINLINE= for compilers that don't support the inline keyword
and presumably the optimizer will just inline it without prompting. The
real fun starts with gcc's static inline and extern inline declarations....
I haven't built a system for *portably* making hints like these to the
compiler. I may have to sooner or later for the MOO server, but just trying
to do the right thing with 32-bit pointers on the Alpha has been hard
enough.
Jay
_______________________________________________
MUD-Dev maillist - MUD-Dev#kanga,nu
http://www.kanga.nu/lists/listinfo/mud-dev
- Thread context:
- Re: [MUD-Dev] Naming and Directories?, (continued)
- Re: [MUD-Dev] Naming and Directories?,
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA, Wed 17 Mar 1999, 18:31 GMT
- Re: [MUD-Dev] Naming and Directories?,
J C Lawrence claw#kanga,nu, Wed 17 Mar 1999, 19:43 GMT
- Re: [MUD-Dev] Naming and Directories?,
Jo Dillon emily#thelonious,new.ox.ac.uk, Thu 18 Mar 1999, 09:59 GMT
- RE: [MUD-Dev] Naming and Directories?,
Jay Carlson nop#mitre,org, Thu 18 Mar 1999, 12:27 GMT
- Re: [MUD-Dev] Multiple clients (was Re: How to support 1000+ simultaneous connections),
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA, Fri 12 Mar 1999, 05:40 GMT
- RE: [MUD-Dev] How to support 1000+ simultaneous connections, and some philosophy.,
Koster, Raph rkoster#origin,ea.com, Thu 11 Mar 1999, 15:14 GMT
- [MUD-Dev] ADMIN: Kanga.Nu outage and other news -- please read,
J C Lawrence claw#varesearch,com, Wed 10 Mar 1999, 22:38 GMT
- [MUD-Dev] How to support 1000+ simultaneous connections, and some philosophy.,
Ben Greear greear#cyberhighway,net, Wed 10 Mar 1999, 05:33 GMT
[ Other Periods
| Other mailing lists
| Search
]