fgmacedo / python-statemachine

Python Finite State Machines made easy.
MIT License
854 stars 84 forks source link

chore: Improved setup time by 40% #433

Closed fgmacedo closed 4 months ago

fgmacedo commented 4 months ago

Improved setup time by 40% changing state and transitions callbacks setup to the class factory (run only once per class instead of by instance creation.

Name (time in us)                              Min                 Max                Mean             StdDev              Median                IQR
-------------------------------------------------------------------------------------------------------------------------------------------------------------
test_setup_performance (NOW)              304.8569 (1.0)      342.2025 (1.0)      318.1129 (1.0)      13.6022 (1.0)      311.9030 (1.0)      25.0701 (1.0)
test_setup_performance (0139_df06976)     421.6639 (1.38)     508.5238 (1.49)     444.7448 (1.40)     25.9961 (1.91)     436.4050 (1.40)     25.7991 (1.03)
-------------------------------------------------------------------------------------------------------------------------------------------------------------

image

Note: The Graph diagram on class now includes all default callbacks hooks, because the class now knows the expected hooks names, even if there's no callback handler on the statemachine class.

sonarcloud[bot] commented 4 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (df06976) to head (21186cc).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #433 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 20 20 Lines 1196 1200 +4 Branches 174 174 ========================================= + Hits 1196 1200 +4 ``` | [Flag](https://app.codecov.io/gh/fgmacedo/python-statemachine/pull/433/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Fernando+Macedo) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/fgmacedo/python-statemachine/pull/433/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Fernando+Macedo) | `100.00% <100.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Fernando+Macedo#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.