[squeak-dev] Re: Future examples (Re: Inbox: #future keyword for
asynchronous message invocation)
Andreas Raab
andreas.raab at gmx.de
Fri Dec 18 17:13:22 UTC 2009
Colin Putney wrote:
> On 2009-12-18, at 1:01 AM, Josh Gargus wrote:
>
>>> Pretty interesting. I'm a bit ambivalent about a magic compiler change like this, but you make a pretty strong case for it's usefulness.
>> That's why Andreas asked me to add the FutureMaker class and the Object future/future: implementations. The same semantics are implemented without any compiler magic; the addition of FutureNode to the compiler is then merely an optimization.
>
> In that case I'd say let's hold off on the compiler changes, until we find that we're using #future so much that it should be inlined.
Oops, sorry forgot to comment on this one. Although strictly speaking
the inlining is optional, it is very, very desirable because one of the
things the compiler does is omitting the need to generate return
promises for every single future message being sent. Since the compiler
knows whether the result of a message is being used or not, we can avoid
creating promises for messages where the result isn't used. In practice,
this turns out to be a significant improvement; for example in Teleplace
the ratio is 4:1 for futures without result promises compared to those
with (886:196 to be precise; this also gives you a feel for how much we
use future messages - they are used more often than #collect: which has
976 senders in the same image). I'd like to retain that optimization if
at all possible.
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|