Experiment: Optional minification#1426
Draft
moreati wants to merge 1 commit intomitogen-hq:masterfrom
Draft
Conversation
Member
Author
import mitogen.master
def foo():
return 42
if __name__ == '__main__':
broker = mitogen.master.Broker()
router = mitogen.master.Router(broker)
context = router.local()
result = context.call(foo)
print(result)➜ mitogen git:(minify-optional) ✗ hyperfine --warmup 1 'python2 hello_local.py' 'MITOGEN_MINIFY=0 python2 hello_local.py' 'python3.14 hello_local.py' 'MITOGEN_MINIFY=0 python3.14 hello_local.py'
Benchmark 1: python2 hello_local.py
Time (mean ± σ): 878.6 ms ± 14.7 ms [User: 670.5 ms, System: 134.8 ms]
Range (min … max): 857.2 ms … 908.0 ms 10 runs
Benchmark 2: MITOGEN_MINIFY=0 python2 hello_local.py
Time (mean ± σ): 725.4 ms ± 5.4 ms [User: 523.6 ms, System: 129.0 ms]
Range (min … max): 717.5 ms … 734.9 ms 10 runs
Benchmark 3: python3.14 hello_local.py
Time (mean ± σ): 276.4 ms ± 7.6 ms [User: 198.9 ms, System: 27.6 ms]
Range (min … max): 265.8 ms … 294.1 ms 11 runs
Benchmark 4: MITOGEN_MINIFY=0 python3.14 hello_local.py
Time (mean ± σ): 261.8 ms ± 4.2 ms [User: 185.8 ms, System: 26.6 ms]
Range (min … max): 256.7 ms … 271.3 ms 10 runs
Summary
MITOGEN_MINIFY=0 python3.14 hello_local.py ran
1.06 ± 0.03 times faster than python3.14 hello_local.py
2.77 ± 0.05 times faster than MITOGEN_MINIFY=0 python2 hello_local.py
3.36 ± 0.08 times faster than python2 hello_local.py |
Member
Author
import mitogen
def foo():
return 42
@mitogen.main()
def main(router):
context = router.local()
result = context.call(foo)
print(result)➜ mitogen git:(minify-optional) ✗ hyperfine --warmup 1 'python2 hello_local2.py' 'MITOGEN_MINIFY=0 python2 hello_local2.py' 'python3.14 hello_local2.py' 'MITOGEN_MINIFY=0 python3.14 hello_local2.py'
Benchmark 1: python2 hello_local2.py
Time (mean ± σ): 727.8 ms ± 3.8 ms [User: 524.1 ms, System: 128.5 ms]
Range (min … max): 721.5 ms … 733.6 ms 10 runs
Benchmark 2: MITOGEN_MINIFY=0 python2 hello_local2.py
Time (mean ± σ): 666.5 ms ± 10.2 ms [User: 463.7 ms, System: 126.5 ms]
Range (min … max): 658.2 ms … 693.7 ms 10 runs
Benchmark 3: python3.14 hello_local2.py
Time (mean ± σ): 195.8 ms ± 1.6 ms [User: 123.3 ms, System: 22.2 ms]
Range (min … max): 192.7 ms … 199.0 ms 15 runs
Benchmark 4: MITOGEN_MINIFY=0 python3.14 hello_local2.py
Time (mean ± σ): 200.1 ms ± 7.6 ms [User: 126.3 ms, System: 22.4 ms]
Range (min … max): 194.5 ms … 226.9 ms 15 runs
Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
Summary
python3.14 hello_local2.py ran
1.02 ± 0.04 times faster than MITOGEN_MINIFY=0 python3.14 hello_local2.py
3.40 ± 0.06 times faster than MITOGEN_MINIFY=0 python2 hello_local2.py
3.72 ± 0.04 times faster than python2 hello_local2.py |
Member
Author
|
fork benchmarks are too noisy to judge by import mitogen
def foo():
return 42
@mitogen.main()
def main(router):
context = router.fork()
result = context.call(foo)
print(result)➜ mitogen git:(minify-optional) ✗ hyperfine --warmup 1 --min-runs 40 'python2 hello_fork.py' 'MITOGEN_MINIFY=0 python2 hello_fork.py' 'python3.14 hello_fork.py' 'MITOGEN_MINIFY=0 python3.14 hello_fork.py'
Benchmark 1: python2 hello_fork.py
Time (mean ± σ): 125.0 ms ± 20.2 ms [User: 66.7 ms, System: 39.1 ms]
Range (min … max): 111.9 ms … 171.2 ms 40 runs
Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
Benchmark 2: MITOGEN_MINIFY=0 python2 hello_fork.py
Time (mean ± σ): 126.0 ms ± 19.9 ms [User: 67.1 ms, System: 39.2 ms]
Range (min … max): 112.2 ms … 169.1 ms 40 runs
Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
Benchmark 3: python3.14 hello_fork.py
Time (mean ± σ): 87.8 ms ± 24.6 ms [User: 42.2 ms, System: 11.2 ms]
Range (min … max): 49.6 ms … 107.7 ms 55 runs
Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
Benchmark 4: MITOGEN_MINIFY=0 python3.14 hello_fork.py
Time (mean ± σ): 90.1 ms ± 23.7 ms [User: 42.5 ms, System: 11.3 ms]
Range (min … max): 51.0 ms … 107.8 ms 54 runs
Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet system without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.
Summary
python3.14 hello_fork.py ran
1.03 ± 0.39 times faster than MITOGEN_MINIFY=0 python3.14 hello_fork.py
1.42 ± 0.46 times faster than python2 hello_fork.py
1.43 ± 0.46 times faster than MITOGEN_MINIFY=0 python2 hello_fork.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Controlled by
MITOGEN_MINIFYenvironment variable on controller.Alternative to #942