2 pointsby all28 hours ago1 comment
  • all28 hours ago
    Hello all,

    My name is Albert and I built this statechart engine to scratch my own itch. I work with embedded systems and in an environment where process is paramount. My current employer has a number of certifications that require semi-annual audits of process, paperwork, etc.

    I kept reaching for tools I knew about (python-statemachine in particular) in order to solve process problems, but nothing really scratched the itch; I needed an engine that took declarative workflows that were versionable and more importantly, not a part of the core runtime. I want to be able to push/pull/up/down workflows the same way I do docker containers. I want those workflows to expose API endpoints and webhooks so I can interface with them in a variety of ways (UI, test completions, ECO/ECR flows involving people, and so on).

    This library is a foundational piece of that puzzle; it gives me a relatively performant statechart execution engine that I can build my dream app on top of.

    It consists of two runtimes: an event driven runtime, and a tick-based runtime. The event driven runtime does not make guarantees about event execution order for parallel states, where the tick-based system does. The tick based runtime is single-threaded on purpose, in order to guarantee event evaluation order, which makes it deterministic.

    As an aside, I plan on building out a number of demos using this engine in the coming weeks. Amongst the demo ideas are: an AI agentic pipeline doing something arbitrary, like research (because why not), a simple game engine integration where the tick-based runtime takes the place of 'system' in an entity-component-system architecture, and probably an http server implementation just for kicks.

    Thanks for taking a look!

    ---

    Oh, and here are some benchmarks for the alpha release:

    StatechartX Benchmarks (i5-5300U, 4 cores, Linux)

      Runtime              Burst      Sustained   Latency   Queue   Allocs
      ---------------------------------------------------------------------
      Realtime (1000Hz)    15.05M/s   ~6.1M/s     279 µs    10K     0
      Core - Simple        8.86M/s    8.86M/s     ~83 ns    100K    0
      Core - Internal      12.08M/s   12.08M/s    ~83 ns    1K      0
      Core - Concurrent    4.00M/s    4.00M/s     ~83 ns    10K     0
      Core - Parallel      3.69M/s    3.69M/s     ~83 ns    100K    0
      Core - Hierarchical  3.41M/s    3.41M/s     ~83 ns    100K    0
      Core - Guarded       3.01M/s    3.01M/s     ~83 ns    100K    0
    
      Memory: 32KB/machine | Zero allocations under load | Graceful backpressure
    
      Event-driven: burst = sustained (constant, predictable)
      Tick-based: burst > sustained (15M submit, 6.1M process)