Skip to content

Commit 63d2048

Browse files
authored
chore: Improve setup performance (#401)
* chore: Setup of pytest-profiling and pytest-benchmark * chore: Reduce 20% of setup time by caching and reusing the method signature adapter * chore: Faster callbacks by not raising handled exceptions to not found attrs * chore: Faster adding callbacks by reusing the same method pointer * chore: Adding a flyweight callable metadata to avoid shared state on StateMachine creation * chore: Improving setup time by changing ensure_callable by a lazy seach_callable to avoid the costs of duplicated register attempts * chore: Add regression test for issue #406
1 parent be10b53 commit 63d2048

19 files changed

Lines changed: 821 additions & 323 deletions

.github/workflows/python-package.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
- name: Install Poetry
3030
uses: snok/install-poetry@v1
3131
with:
32+
version: 1.5.1
3233
virtualenvs-create: true
3334
virtualenvs-in-project: true
3435
installer-parallel: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ pip-log.txt
4040
pip-delete-this-directory.txt
4141

4242
# Unit test / coverage reports
43+
prof/
44+
.benchmarks/
4345
htmlcov/
4446
.tox/
4547
.coverage

poetry.lock

Lines changed: 133 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ mypy = "^0.991"
4646
black = "^22.12.0"
4747
pdbpp = "^0.10.3"
4848
pytest-mock = "^3.10.0"
49+
pytest-profiling = "^1.7.0"
50+
pytest-benchmark = "^4.0.0"
51+
pytest-line-profiler = "^0.2.1"
4952

5053
[tool.poetry.group.docs.dependencies]
5154
Sphinx = "4.5.0"
@@ -60,13 +63,14 @@ requires = ["poetry-core"]
6063
build-backend = "poetry.core.masonry.api"
6164

6265
[tool.pytest.ini_options]
63-
addopts = "--ignore=docs/conf.py --ignore=docs/auto_examples/ --ignore=docs/_build/ --ignore=tests/examples/ --cov --cov-config .coveragerc --doctest-glob='*.md' --doctest-modules --doctest-continue-on-failure"
66+
addopts = "--ignore=docs/conf.py --ignore=docs/auto_examples/ --ignore=docs/_build/ --ignore=tests/examples/ --cov --cov-config .coveragerc --doctest-glob='*.md' --doctest-modules --doctest-continue-on-failure --benchmark-autosave"
6467
doctest_optionflags = "ELLIPSIS IGNORE_EXCEPTION_DETAIL NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL"
6568

6669
[tool.mypy]
6770
python_version = "3.11"
6871
warn_return_any = true
6972
warn_unused_configs = true
73+
disable_error_code = "annotation-unchecked"
7074

7175
[[tool.mypy.overrides]]
7276
module = [

0 commit comments

Comments
 (0)