Commit Graph

23 Commits (docs-master)

Author SHA1 Message Date
Alex Willmer 090952a987 Python 3.14 support 3 months ago
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
Alex Willmer 3093d0bb2d tests: Add scan_code_imports benchmark
```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
```
4 months ago
Alex Willmer 18c89de5a9 Remove unused module imports 4 years ago
Alex Willmer c87976af40 tests: Fix lingering Python 2 isms 4 years ago
David Wilson 57012e0f72 Add mitogen.core.now() and use it everywhere; closes #614. 6 years ago
David Wilson 12569ad70a tests/bench: import ssh-roundtrip.py. 7 years ago
David Wilson ffdf31edd7 tests/bench: set process affinity in throughput.py. 7 years ago
David Wilson e703522010 issue #505: docs: add new detail graph for one scenario. 7 years ago
David Wilson fda7d5c276 bench: tidy up and cpu-pin some more files. 7 years ago
David Wilson e77048ec2d utils: pad out reset_affinity() and integrate with detach_popen() 7 years ago
David Wilson fedd294f96 issue #485: import new throuhgput bench 7 years ago
David Wilson dd30a907ce issue #477: promote setup_gil() to mitogen.utils
This is since ansible_mitogen/process.py is 2.6-only, and I want to use
setup_gil() in 2.4 code.
7 years ago
David Wilson 7c33979e25 issue #415: add IPC latency bench. 7 years ago
David Wilson 3836c6a220 tests/bench: run roundtrip.py a ton more to reduce variance 7 years ago
David Wilson 918f709420 tests: import a bunch more random unchecked in pieces. 7 years ago
David Wilson 3943634fa6 tests: import bench/large_messages.py. 7 years ago
David Wilson a05835c46e tests: more stable roundtrip.py. 8 years ago
David Wilson e1402b2214 tests: import various bench/ scripts. 8 years ago
David Wilson 410016ff47 Initial Python 3.x port work.
* ansible: use unicode_literals everywhere since it only needs to be
  compatible back to 2.6.
* compat/collections.py: delete this entirely and rip out the parts of
  functools that require it.
* Introduce serializable Kwargs dict subclass that translates keys to
  Unicode on instantiation.
* enable_debug_logging() must set _v/_vv globals.
* cStringIO does not exist in 3.x.
* Treat IOLogger and LogForwarder input as latin-1.
* Avoid ResourceWarnings in first stage by explicitly closing fps.
* Fix preamble_size.py syntax errors.
8 years ago
David Wilson 8ca8b43df1 tests/bench: import "slightly more reliable time" script 8 years ago
David Wilson eb402c8bd4 tests/bench: import wrapper script used for blog charts 8 years ago
David Wilson 17aef51e6e tests: Import .local() latency test 8 years ago