
Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [tlug] Re: tlug-digest Digest V2004 #194
> ... Is it so unusual to
> inline Assembler?
These days, it should be unheard of (except at the very lowest level of
the O/S).
> ... I know on Windows we used for graphics all the time
> DirectX, in old DOS-timess we rewrote all the graphic-routines we needed
> and wrote those we will need completely Assembler,,,
Back in the days when compilers were pretty stupid, it sometimes made
sense to re-write things in assembly to squeeze out a bit of extra speed.
But about 20 years ago I had an in-depth debate with a compiler writer
and he convinced me that a good compiler could be able keep track of more
stuff optimization-wize than even the best assembly coders and I'm sure
today's compilers are even better.
I did a consulting gig years ago where the guy before me had inlined a
bunch of assembly in a C program. I thought the assembly looked kinda
funny and, oddly enough, it had C-like comments embedded in the source.
After some experimentation, I found that the inlined assembly was actually
the output of the C compiler, no doubt captured from a previous compile
run. Duhhh...
Assembly is not any faster than C unless you have a really dumb compiler
or you're bit-twiddling at the hardware level. Those cases *are* rare.
[Note: the same comparison cannot be made between, say, C and Perl,
because the latter does a lot of behind-the-scenes stuff that takes
additional CPU time. C does not. So while it makes little sense to inline
assembler in C, it could make a big difference inlining C into a Perl
script if you know what you're doing.]
--
Joe Larabell -- Synopsys VCS Support US: larabell@example.com
http://wwwin.synopsys.com/~larabell/ Japan: larabell@?jp
Home |
Main Index |
Thread Index