In real life, we have never had a speed problem with VFX, despite dealing with over 100 much more complex state machines simultaneously in one 20ms thread, plus around 20 other threads doing user interface, communications with loads of other devices, and lots of database stuff.
However - since we are getting competitive, here's a suggestion.
Enumerate ALL possible states - a combination of light state and direction.
Create a table defining the next state for each state.
The transition simply does a lookup to generate the next state - almost certainly quicker than CASE, comparisons and IFs.
In the good old days of Fig style Forth on 2MHz microcontrollers, when performance really was an issue, I remember this was an effective technique.
Any good?
I'm highly suspicious of the Rust figures - are we comparing like with like?
Nick Nelson