Re: Speeding up XCode?
Re: Speeding up XCode?
- Subject: Re: Speeding up XCode?
- From: George Warner <email@hidden>
- Date: Wed, 19 Oct 2005 09:58:56 -0700
- Thread-topic: Speeding up XCode?
On Wed, 19 Oct 2005 00:30:07 -0400, Cameron Hayne <email@hidden>
wrote:
>> People that haven't grown up with 48k RAM, 1MHz machines that had
>> to hand code for streamlined speed don't know how to optimize
>> properly. functions do NOT increase speed, they REDUCE the speed.
This is NOT necessarily true. Suppose that you have a routine that call
another four times from within a loop. And suppose that inlining that
routine would expand the parent routine such that it no longer fits in the
instruction cache (very likely on non-associative caches). The cache misses
are guaranteed to cause more processing stalls than the overhead of the
function calls.
> My first big programming project was writing a BASIC compiler in Z80
> assembler for the Sinclair Spectrum. I know how to hand code - I
> spent several evenings recoding some parts just to save a few dozen
> bytes.
Drool... That was a GREAT machine. Very elegant in its simplicity. I
remember that it used a hardware interrupt to execute a series (80?) of POP
instructions to load each row of video buffers (IIRC 24x60 times a second).
(IIRC this trick was documented by Don Lancaster in his Video Typewriter
Cookbook.) It worked but I'm sure that that cost more CPU overhead than any
function call. ;-)
> But my point above is that most of us are not writing assembly code
> anymore and there is no reason to do something similar when coding in C.
The trick with optimizing C is to know how the compiler generates code and
to write your C sources in a way that the compiler can take best advantage
of. Once upon a time the best way to learn this was by comparing source to
(dis-)assembly... manually... ug! These days SHARK will do it for you with
cute little notes ("!") that will give you detailed information about why a
section of code isn't performing as well as it could and what you can do in
your C source to make it perform better. (Ok, so basically it's me
automated. ;-)
--
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden