qmuntal / stateless

Go library for creating finite state machines
BSD 2-Clause "Simplified" License
898 stars 47 forks source link

Reduce state transition allocations #65

Closed qmuntal closed 10 months ago

qmuntal commented 10 months ago

The current implementation of stateRepresentation.findHandler is overcomplicated and allocates too much.

This PR simplifies it, making it more performant, both in terms of memory allocations and complexity.

Fixes #64

qmuntal commented 10 months ago

@k-raval can you check if these changes improves your performance issues with stateRepresentation.findHandler?

k-raval commented 10 months ago

Thanks @qmuntal , your fix is working as expected. Performance in terms of number of object allocations have come down.