GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||
GeezerVison is showing github.com — gh-118761: Improve import time of `pprint` by hugovk · Pull Request #122725 · python/cpython Conversation
|
main
| PR |
|---|---|
|
|
pprint import time: 0.014s -> 0.002s = x7 as fastmain
| PR |
|---|---|
|
|
❯ hyperfine --warmup 8 "./python.exe -c 'import pprint'" Benchmark 1: ./python.exe -c 'import pprint' Time (mean ± σ): 19.2 ms ± 0.7 ms [User: 15.8 ms, System: 2.8 ms] Range (min … max): 18.1 ms … 21.3 ms 135 runs
❯ hyperfine --warmup 8 "./python.exe -c 'import pprint'" Benchmark 1: ./python.exe -c 'import pprint' Time (mean ± σ): 10.4 ms ± 0.4 ms [User: 8.1 ms, System: 1.8 ms] Range (min … max): 9.8 ms … 12.4 ms 212 runs
Also add some PEP 8 whitespace to remove some distracting IDE warnings.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
By the way, what's the reason for importing with underscores? import collections as _collections import sys as _sys import types as _types from io import StringIO as _StringIO |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks fine -- I wouldn't change the whitespace personally but up to you.
collections you could do by hardcoding the repr and adding a test that they're the same? I agree probably not worth it, though.
A
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.