Giter Site home page Giter Site logo

Comments (3)

fgmacedo avatar fgmacedo commented on June 11, 2024 1

Hi, thanks for the feedback. It's a good goal for my effort.

I had never worked on turning the startup processing because I usually create a few instances on my use cases.

One of the setup performance costs is a unique feature that I call "dynamic dispatch", so the state machine can have multiple observers. It can handle callbacks with distinct signatures from the event being called.

No problem, I'm glad you took the time to open the issue so I can go deeper into this theme.

Best regards!

from python-statemachine.

fgmacedo avatar fgmacedo commented on June 11, 2024

Hi @pavelschon , thanks for reporting this! I'll run a profile and try to identify improvements. This is the first report of this nature.

Is it legal to swap the model in StateMachine?

I think It will not work because we use the model as an observer, so any reference to guards and actions are pre-cached and stored as references to the attributes. I think that its partially the cause of the initial setup costs, so in order to speed up the execution we have a cost on the setup.

from python-statemachine.

pavelschon avatar pavelschon commented on June 11, 2024

Thank you for quickly digging into it and began the effort on improvements!
We had also a look at similar project pytransitions/transitions and compared the performance. The StateMachine was functionally identical in both:

  • python-statemachine: create 10000 instances of StateMachine: 53 seconds on laptop
  • pytransitions: create 10000 instances of StateMachine: 1.8 seconds on laptop

Due to the better performance we have to go with pytransitions, despite I like the syntax of python-statemachine more.

from python-statemachine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.