Mirror of mitogen
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Go to file
Alex Willmer 0e5f47f145 mitogen: Refactor scan_code_imports() as mitogen.imports.codeobj_imports()
This replaces `mitogen.master.scan_code_imports()` with
`mitogen.imports.codeobj_imports()`. The Python 3.x implementation now uses
`str.find()`, relying on Python >= 3.6 "widecode" format. Behaviour and
semantics should be unchanged. Now implementations are approx
- 1.5 x faster on Python 2.x
- 2 - 3 x faster on Python 3.x

Before
```console
$ ./tests/bench/scan_code
scan_code_imports python2.7  100 loops, best of 3: 3.19 msec per loop
scan_code_imports python3.9  500 loops, best of 5: 685 usec per loop
scan_code_imports python3.10  500 loops, best of 5: 727 usec per loop
scan_code_imports python3.11  500 loops, best of 5: 601 usec per loop
scan_code_imports python3.12  500 loops, best of 5: 609 usec per loop
scan_code_imports python3.13  500 loops, best of 5: 586 usec per loop
```

After
```console
codeobj_imports python2.7  1000 loops, best of 3: 1.98 msec per loop
codeobj_imports python3.9  1000 loops, best of 5: 302 usec per loop
codeobj_imports python3.10  1000 loops, best of 5: 297 usec per loop
codeobj_imports python3.11  1000 loops, best of 5: 243 usec per loop
codeobj_imports python3.12  1000 loops, best of 5: 278 usec per loop
codeobj_imports python3.13  1000 loops, best of 5: 259 usec per loop
```
```console
$ uname -a
Darwin kintha 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT
2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000 arm64
```
4 months ago
.ci CI: Combine build deps & tooling steps 4 months ago
.github CI: Combine build deps & tooling steps 4 months ago
ansible_mitogen mitogen: Refactor scan_code_imports() as mitogen.imports.codeobj_imports() 4 months ago
docs mitogen: Refactor scan_code_imports() as mitogen.imports.codeobj_imports() 4 months ago
examples Remove get_password_hash, unused 1 year ago
mitogen mitogen: Refactor scan_code_imports() as mitogen.imports.codeobj_imports() 4 months ago
scripts add Python3 compatibility 2 years ago
tests mitogen: Refactor scan_code_imports() as mitogen.imports.codeobj_imports() 4 months ago
.gitignore chore: Ignore locally installed collections, dummy modules, etc 6 months ago
.lgtm.yml Whoops, merge together lgtm.yml and .lgtm.yml 6 years ago
LICENSE Bump copyright year and use generic author name (testing Travis) 5 years ago
MANIFEST.in setup.py: include LICENSE; closes #538. 7 years ago
README.md docs: shields.io badges for PyPI version & supported Python versions 1 year ago
dev_requirements.txt Split dev_requirements.txt up according to test mode. 7 years ago
netlify.toml docs: Attempt to configure Netlify build of mitogen.networkgenomics.com 11 months ago
preamble_size.py mitogen.parent: Remove tabs from minimized first stage 4 years ago
run_tests tests: Remove unittest2, use stdlib unittest 4 years ago
setup.cfg Keep comatibility with `setuptools` tagging wheels with `py2.py3` 6 months ago
setup.py packaging: Handle pre-release __version__ tuples 6 months ago
tox.ini CI: Abbreviate Github Actions job names 4 months ago

README.md