Re: loop efficiency & messages
Re: loop efficiency & messages
- Subject: Re: loop efficiency & messages
- From: Ondra Cada <email@hidden>
- Date: Tue, 22 Mar 2005 23:17:30 +0100
On 22.3.2005, at 22:52, Corey O'Connor wrote:
However, I could
imagine this would be a desirable feature. I think MuleKybernetic (?)
had an article on "selector caching", or such, that discussed how to
solve this particular problem. I dunno if I'd consider their technique
a compile-time feature however.
Exactly: yup, if you want to "cache selectors" (more precisely, cache
the entry point of the method and call it directly as a function
without any message dispatching overhead), just do -- knowing of the
potential problems and accepting them. Don't though want the compiler
to do that silently for you, with a possibility of nasty surprises :)
On 22.3.2005, at 23:04, Hamish Allan wrote:
It seems to me that there's a really easy way to signal to the
compiler to cache the result of the getCount in a register:
Absolutely. And, if that is indeed your intention...
int count = [self getCount];
for (i = 0; i < count; ++i)
... you can even declare it "register int count", to reveal it to other
programmers who may read the code. And who knows, the compiler might
perhaps take it into account, too :))
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden