[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Ah, those uninitiated people...
- From: Wesley Smith <wesley.hoke@...>
- Date: Thu, 14 Jan 2010 08:26:31 +0100
> It's not the same, though. Apart from having to reorder my logic to suit
> the restrictions of the language, which is always a pain, there's a
> performance hit in that shared state has to be accessed via upvalues
> rather than locals, which are considerably more expensive --- not just
> to access, but also to create individual closures for each state in your
> state machine. Say you have a state-machine based parser for network
> packets. You have two choices: construct and then discard potentially
> hundreds of closures for every packet, or restructure the entire state
> machine not to need shared state. One's slow, the other's inconvenient.
Is that really true? I'm not sure I buy it. Why can't you use
coroutines with locals and and infinite loop to implement your state
machine? I've done this in many situations and have never had the
need for upvalues.
wes
- References:
- Ah, those uninitiated people..., Alexander Gladysh
- Re: Ah, those uninitiated people..., Tony Finch
- Re: Ah, those uninitiated people..., Wesley Smith
- Re: Ah, those uninitiated people..., David Kastrup
- Re: Ah, those uninitiated people..., Tony Finch
- Re: Ah, those uninitiated people..., David Kastrup
- Re: Ah, those uninitiated people..., Tony Finch
- Re: Ah, those uninitiated people..., David Kastrup
- Re: Ah, those uninitiated people..., Tony Finch
- Re: Ah, those uninitiated people..., David Given