gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOFault / NSAutoreleasePool


From: David Ayers
Subject: Re: EOFault / NSAutoreleasePool
Date: Tue, 18 Mar 2008 19:51:28 +0100
User-agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080110)

Richard Frith-Macdonald schrieb:
> 
> Yes, though ideally it could work ... because
> [NSDistantObject-methodForSelector:] could return the address of code
> which will forward the message to the other process.  This would
> actually not be too hard to implement.

Sounds neat!

> I'm not to clear on what an NSDistantObject ought to do according to the
> documentation though:
> The documentation doesn't say it implements -methodForSelector: or
> +instanceMethodForSelector: so perhaps it should return the address of
> the method in the remote process ... which is kind of odd.  If you
> accept that interpretation then the common practice of caching method
> implementations for optimisation must always be considered unsafe unless
> you can guarantee that no proxy object will ever reach that code.

Yes... if you take the language by the letter you can implement an
object that call arbitrary invocation in forwardInvocation:.  Nothing in
the the language says that sending the same message twice must invoke
the identical implementation.  If you take that as a given both
-methodForSelector and +instanceMethodForSelector: (and subsequently IMP
caching) are only useful for defined methods of defined classes (albeit
most classes and methods).

> So ... technically the optimisation in NSAutoreleasePool is clearly
> unsafe, but in practice it's probably worth keeping it even so (the
> person who suggested it to me said it had made a 20% performance boost
> to their code).

I fully agree that for practicality such optimization are more than
useful in benchmarked cases and I'm willing to do what is necessary to
have it 'just work'...  But that can be hard or sometimes impossible.

In this case I think we have decent compromise.  And I'd like the
get_imp approach even better.  I'm not sure whether we need to take
special precautions for double release checking wrt
EOFault/NSAutoreleasePool and the cached IMP.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]