Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 879 Bytes

README.md

File metadata and controls

28 lines (21 loc) · 879 Bytes

A performance oriented implementation of a state machine

Design decisions

  • Based on benchmark this implementation is based on the CRTP visitor pattern as it seem to be the fastest between LLVM 15 and GCC 12.1 (pictured).

Clang 15 GCC 12.1

  • Header only library
  • No internal/external events, no pre/post transition actions, no explicit guards other than preventing invalid transitions (see examples).
  • The initial state is implicitly defined with the first element in states.

TODO:

  • handle leveraged markets (e.g. margin calls)

Usage

Run benchmarks:

mkdir build && cd build
cmake ..
make all
./bin/benchmark_StaticPolymorphism

Examples

In example/OrderFSM.hpp we show how to implement this state graph of an order with IOT, IOK, GTD and GTC.

State graph