Re: LZ: Emulator for MAC
[Prev][Next][Index][Thread]
Re: LZ: Emulator for MAC
On Fri, 4 Oct 1996 13:52:43 -0400 (EDT), you wrote:
><SNIP>
>> maybe some one was written a z80 emulator in asm for the MAC ?
>
> The speed of C really depends on the compiler. On the Mac, all the=20
>routines are in ROM anyway, so ASSEMBLER CAUSES NO SPEED INCREASE.
> I can see a slew of uninformed opinions sprining up, so I should point
>out that any compiled language becomes assembler anyway, and the only =
thing
>that gets faster are device-access routines - which, as I said, are in =
ROM
>on the Mac; thus it's FASTER to use C.
> (Apologies to anyone I've offended).
>
Actually, that's not entirely true. The speed increase (especially in
fast risc processors like the power PC, or some of the SPARCs) is
small, but there's a speed increase nonetheless. Whether or not the
device-access routines are in ROM or not, it doesn't matter. Granted,
keeping the hardware access routines in ROM diminshes the differences
somewhat, but there are still differences. Not all of the C and C++
"overhead" comes from device access independance. When you compile
the code, the compiler uses its "standard" routines for everything,
i.e., work on integers, do this floating point operation, access this
math library function, do this loop, etc. The compiler is not "smart"
in the sense of it doesn't use code workarounds, shortcuts, "tricks",
etc. It applies the "standard" operating procedures. For a class I
once wrote and compiled a C++ program, and then turned around and did
it in x86 assembly. The C++ program compiled to about 15k, and the
assembly program was about 3k. If I did it in 68k assembly the
difference might have been less dramatic, but I'm sure there would
still be a difference. I'm doing some java stuff now, and the
overhead is tremendous compared to raw assembly!
If you ever look at dissassembled C code, it's usually a big mess.
There are all sorts of inefficiences, merely because the C code must
be written to apply to all situations, and many hardware
configurations (this becomes especially aparent on DOS machines).
Someone good at assembly language (and someone with a lot of time) can
always write a more efficient program than someone in using C. If you
don't believe me, why do 3d racasting engines like DOOM (and just
about every other game) have lots of inline assembly language, even on
Mac versions? If the programmers had the time/patience/resources, I'm
sure they'd write the whole game in assembly language. That's
probably true of all software developers.
-Mel
References: