Boost logo

Boost :

Subject: Re: [boost] [MSM] Comparison with ad-hoc FSM implementation
From: Edouard A. (edouard_at_[hidden])
Date: 2009-12-10 02:53:16


>This is O(1). Of course a difference is that it has different
>entry points for the different events. This doesn't seem unreasonable
>to me, but if you wanted a single entry point you could do something
>like:

I'd like to point out that the implementation of switch is generally pretty
slow, and we're talking about a code which is generally on the critical
path.

Switch implies jumping to a computed address (something like jmp
[eax*8+ebx]... you get the idea), this is very bad for branch prediction and
for the pipeline of your beloved processor - assuming you're working on
something close to the IA32 or AMD64.

MSM's generated code will most likely contain only fixed jumps which behave
much, much better, notwithstanding the fact that the template's context will
help the compiler make better decisions about optimizations, resulting in
favorable contexts in unconditional code.

If you care about performance, you want those jumps out of your ways.

-- 
EA
 
 
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4674 (20091209) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
 

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk