Dan Sugalski <[EMAIL PROTECTED]> wrote:
... It's desperately un-thread-safe, which is one of the things that didn't make it out in my last reply.
Your recent words related to threads were: we don't optimize for threaded programs. We optimize for the common case, that is single-threaded.
I forgot that in my proposal. Subroutine PMCs need duplication for new threads.
That doesn't work for closures, which can be shared across threads in a pool. Also, in the face of continuations the cache is useful exactly *once* (since from then on there might be a handle on it), after which you have to recreate anyway. The only way the cache would be useful would be if you created it when the sub pmc is initially created, but then you're going to end up creating frames that won't otherwise be used, which is a waste, with no savings anywhere else, since the cache doesn't buy you anything anyway, as it's one-use.
> .. You can't cache state data like this, it meansthat you can't have two or more threads in the same sub PMC at once.
Yes. of course. So with the small cost of duplicating sub PMCs for multiple threads we can toss all register saving code.
Sorry, no, that just doesn't work. You still end up with a lot of allocation and copying time, and add in an extra level of indirection to register access for a 2-3% speed hit in general. I don't see it as a win.
--
Dan
--------------------------------------it's like this------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk