Closed JaydenFish closed 7 months ago
Great question. ATM: sml2 has the same run-time performance as sml if_else policy. Notice that sml has more policies as well such as (jump_table, fold_expr, switch_stm, etc...) and switch_stm is the default one. Also the ONLY run-time performance execution is required if there are multiple src states for the same events, otherwise it will be commpile-time dispatch with zero overhead, so it's kinda depends on the state machine.
sml2 on the other hand has faster compilation-times than sml but also less features (sml2 doesn't support hierarchical sm atm).
I've been playing around with simd based policy for the dispatch if available in the hardware but that's neither ready nor applicable for everyone.
The size overhead of the state machine should be the same, so the cache utilization will be similar and will depend on the underlying design of dependencies.
Overall, the perf is very similar and will depend on the state machine.
Encourage to play around in godbolt to see generated assembly - https://godbolt.org/z/WEr7qTeqM.
If the performance is the main factor would also switch from guards and multiple states per event to purely event based approach (different events for different things). That's guaranteed to always be inlined without any run-time execution as it will be compile-time bound.
How is it comparing to boost::sml? Same as boost::sml or better? There is only boost::sml on
https://github.com/boost-ext/sml/tree/master/benchmark
.