GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-118761: Improve import time by lazy import of `warnings` by donbarbos · Pull Request #129765 · python/cpython

Conversation

@donbarbos

@donbarbos donbarbos commented Feb 7, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • Improve import time modules by lazy import warnings.
  • Remove unused warnings and struct from Lib/ctypes/_layout.py.

My hyperfine benchmarks:

First experiment in Main branch

➜  cpython git:(43e0240213) ✗ hyperfine --warmup 11 "./python -c 'import codeop'" "./python -c 'import zipimport'" "./python -c 'import ctypes'" "./python -c 'import hmac'" "./python -c 'import importlib'" "./python -c 'import logging'" "./python -c 'import pkgutil'" "./python -c 'import pydoc'" "./python -c 'import rlcompleter'" "./python -c 'import ssl'" "./python -c 'import tempfile'" "./python -c 'import traceback'" "./python -c 'import urllib'" "./python -c 'import xml'"
Benchmark 1: ./python -c 'import codeop'
  Time (mean ± σ):      24.6 ms ±   1.0 ms    [User: 21.8 ms, System: 2.7 ms]
  Range (min … max):    23.4 ms …  32.9 ms    112 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: ./python -c 'import zipimport'
Time (mean ± σ): 22.7 ms ± 0.8 ms [User: 20.0 ms, System: 2.6 ms]
Range (min … max): 21.8 ms … 28.6 ms 128 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: ./python -c 'import ctypes'
Time (mean ± σ): 27.4 ms ± 0.5 ms [User: 24.1 ms, System: 3.2 ms]
Range (min … max): 26.5 ms … 29.3 ms 108 runs

Benchmark 4: ./python -c 'import hmac'
Time (mean ± σ): 27.2 ms ± 0.5 ms [User: 23.8 ms, System: 3.3 ms]
Range (min … max): 26.3 ms … 28.9 ms 108 runs

Benchmark 5: ./python -c 'import importlib'
Time (mean ± σ): 23.1 ms ± 0.9 ms [User: 20.3 ms, System: 2.6 ms]
Range (min … max): 22.1 ms … 31.3 ms 122 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 6: ./python -c 'import logging'
Time (mean ± σ): 51.9 ms ± 0.6 ms [User: 47.8 ms, System: 4.0 ms]
Range (min … max): 50.6 ms … 53.4 ms 56 runs

Benchmark 7: ./python -c 'import pkgutil'
Time (mean ± σ): 52.2 ms ± 0.9 ms [User: 48.3 ms, System: 3.8 ms]
Range (min … max): 50.4 ms … 54.8 ms 58 runs

Benchmark 8: ./python -c 'import pydoc'
Time (mean ± σ): 89.2 ms ± 1.7 ms [User: 83.4 ms, System: 5.6 ms]
Range (min … max): 87.2 ms … 95.0 ms 34 runs

Benchmark 9: ./python -c 'import rlcompleter'
Time (mean ± σ): 61.8 ms ± 1.1 ms [User: 57.0 ms, System: 4.6 ms]
Range (min … max): 60.1 ms … 65.8 ms 49 runs

Benchmark 10: ./python -c 'import ssl'
Time (mean ± σ): 47.6 ms ± 1.8 ms [User: 43.1 ms, System: 4.3 ms]
Range (min … max): 45.1 ms … 57.6 ms 63 runs

Benchmark 11: ./python -c 'import tempfile'
Time (mean ± σ): 47.2 ms ± 1.1 ms [User: 42.9 ms, System: 4.3 ms]
Range (min … max): 45.2 ms … 49.9 ms 63 runs

Benchmark 12: ./python -c 'import traceback'
Time (mean ± σ): 43.5 ms ± 1.2 ms [User: 39.8 ms, System: 3.5 ms]
Range (min … max): 41.7 ms … 46.8 ms 65 runs

Benchmark 13: ./python -c 'import urllib'
Time (mean ± σ): 25.9 ms ± 1.7 ms [User: 22.8 ms, System: 2.9 ms]
Range (min … max): 22.5 ms … 34.3 ms 128 runs

Benchmark 14: ./python -c 'import xml'
Time (mean ± σ): 26.2 ms ± 0.9 ms [User: 23.5 ms, System: 2.6 ms]
Range (min … max): 24.5 ms … 29.2 ms 114 runs

Summary
./python -c 'import zipimport' ran
1.02 ± 0.05 times faster than ./python -c 'import importlib'
1.08 ± 0.06 times faster than ./python -c 'import codeop'
1.14 ± 0.09 times faster than ./python -c 'import urllib'
1.16 ± 0.06 times faster than ./python -c 'import xml'
1.20 ± 0.05 times faster than ./python -c 'import hmac'
1.21 ± 0.05 times faster than ./python -c 'import ctypes'
1.92 ± 0.09 times faster than ./python -c 'import traceback'
2.08 ± 0.09 times faster than ./python -c 'import tempfile'
2.10 ± 0.11 times faster than ./python -c 'import ssl'
2.29 ± 0.09 times faster than ./python -c 'import logging'
2.30 ± 0.09 times faster than ./python -c 'import pkgutil'
2.72 ± 0.11 times faster than ./python -c 'import rlcompleter'
3.93 ± 0.16 times faster than ./python -c 'import pydoc'

Second experiment in Main branch

➜  cpython git:(43e0240213) ✗ hyperfine --warmup 11 "./python -c 'import codeop'" "./python -c 'import zipimport'" "./python -c 'import ctypes'" "./python -c 'import hmac'" "./python -c 'import importlib'" "./python -c 'import logging'" "./python -c 'import pkgutil'" "./python -c 'import pydoc'" "./python -c 'import rlcompleter'" "./python -c 'import ssl'" "./python -c 'import tempfile'" "./python -c 'import traceback'" "./python -c 'import urllib'" "./python -c 'import xml'"
Benchmark 1: ./python -c 'import codeop'
  Time (mean ± σ):      24.5 ms ±   1.6 ms    [User: 21.7 ms, System: 2.8 ms]
  Range (min … max):    23.5 ms …  39.7 ms    119 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: ./python -c 'import zipimport'
Time (mean ± σ): 22.8 ms ± 1.0 ms [User: 20.4 ms, System: 2.3 ms]
Range (min … max): 21.7 ms … 30.3 ms 129 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: ./python -c 'import ctypes'
Time (mean ± σ): 27.6 ms ± 0.9 ms [User: 24.5 ms, System: 2.9 ms]
Range (min … max): 26.5 ms … 34.3 ms 105 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: ./python -c 'import hmac'
Time (mean ± σ): 27.1 ms ± 0.6 ms [User: 23.7 ms, System: 3.3 ms]
Range (min … max): 26.2 ms … 28.8 ms 108 runs

Benchmark 5: ./python -c 'import importlib'
Time (mean ± σ): 23.9 ms ± 1.2 ms [User: 21.4 ms, System: 2.3 ms]
Range (min … max): 22.0 ms … 26.4 ms 126 runs

Benchmark 6: ./python -c 'import logging'
Time (mean ± σ): 59.0 ms ± 2.9 ms [User: 54.6 ms, System: 4.3 ms]
Range (min … max): 56.5 ms … 73.0 ms 52 runs

Benchmark 7: ./python -c 'import pkgutil'
Time (mean ± σ): 61.2 ms ± 3.9 ms [User: 56.1 ms, System: 5.0 ms]
Range (min … max): 55.4 ms … 68.4 ms 53 runs

Benchmark 8: ./python -c 'import pydoc'
Time (mean ± σ): 114.4 ms ± 3.4 ms [User: 106.5 ms, System: 7.7 ms]
Range (min … max): 111.3 ms … 122.7 ms 26 runs

Benchmark 9: ./python -c 'import rlcompleter'
Time (mean ± σ): 78.8 ms ± 1.2 ms [User: 72.5 ms, System: 6.1 ms]
Range (min … max): 76.7 ms … 81.0 ms 38 runs

Benchmark 10: ./python -c 'import ssl'
Time (mean ± σ): 58.8 ms ± 0.9 ms [User: 53.4 ms, System: 5.3 ms]
Range (min … max): 57.4 ms … 61.6 ms 50 runs

Benchmark 11: ./python -c 'import tempfile'
Time (mean ± σ): 59.8 ms ± 1.8 ms [User: 54.2 ms, System: 5.5 ms]
Range (min … max): 57.4 ms … 69.4 ms 50 runs

Benchmark 12: ./python -c 'import traceback'
Time (mean ± σ): 54.8 ms ± 1.0 ms [User: 50.3 ms, System: 4.4 ms]
Range (min … max): 52.4 ms … 56.9 ms 56 runs

Benchmark 13: ./python -c 'import urllib'
Time (mean ± σ): 29.5 ms ± 0.6 ms [User: 26.2 ms, System: 3.1 ms]
Range (min … max): 28.3 ms … 31.9 ms 100 runs

Benchmark 14: ./python -c 'import xml'
Time (mean ± σ): 29.7 ms ± 1.1 ms [User: 26.7 ms, System: 3.0 ms]
Range (min … max): 28.2 ms … 38.3 ms 102 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
./python -c 'import zipimport' ran
1.05 ± 0.07 times faster than ./python -c 'import importlib'
1.08 ± 0.08 times faster than ./python -c 'import codeop'
1.19 ± 0.06 times faster than ./python -c 'import hmac'
1.21 ± 0.07 times faster than ./python -c 'import ctypes'
1.29 ± 0.06 times faster than ./python -c 'import urllib'
1.30 ± 0.07 times faster than ./python -c 'import xml'
2.40 ± 0.11 times faster than ./python -c 'import traceback'
2.58 ± 0.12 times faster than ./python -c 'import ssl'
2.58 ± 0.17 times faster than ./python -c 'import logging'
2.62 ± 0.14 times faster than ./python -c 'import tempfile'
2.68 ± 0.20 times faster than ./python -c 'import pkgutil'
3.45 ± 0.16 times faster than ./python -c 'import rlcompleter'
5.01 ± 0.26 times faster than ./python -c 'import pydoc'

First experiment in PR branch

➜  cpython git:(issue-118761) ✗ hyperfine --warmup 11 "./python -c 'import codeop'" "./python -c 'import zipimport'" "./python -c 'import ctypes'" "./python -c 'import hmac'" "./python -c 'import importlib'" "./python -c 'import logging'" "./python -c 'import pkgutil'" "./python -c 'import pydoc'" "./python -c 'import rlcompleter'" "./python -c 'import ssl'" "./python -c 'import tempfile'" "./python -c 'import traceback'" "./python -c 'import urllib'" "./python -c 'import xml'"
Benchmark 1: ./python -c 'import codeop'
  Time (mean ± σ):      23.5 ms ±   1.0 ms    [User: 21.0 ms, System: 2.5 ms]
  Range (min … max):    22.6 ms …  33.2 ms    121 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: ./python -c 'import zipimport'
Time (mean ± σ): 22.6 ms ± 0.8 ms [User: 20.3 ms, System: 2.2 ms]
Range (min … max): 21.6 ms … 29.5 ms 127 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: ./python -c 'import ctypes'
Time (mean ± σ): 27.3 ms ± 0.5 ms [User: 24.3 ms, System: 3.0 ms]
Range (min … max): 26.4 ms … 29.0 ms 107 runs

Benchmark 4: ./python -c 'import hmac'
Time (mean ± σ): 26.2 ms ± 0.6 ms [User: 23.3 ms, System: 2.9 ms]
Range (min … max): 25.3 ms … 27.7 ms 108 runs

Benchmark 5: ./python -c 'import importlib'
Time (mean ± σ): 22.9 ms ± 1.3 ms [User: 20.6 ms, System: 2.3 ms]
Range (min … max): 22.0 ms … 35.4 ms 125 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 6: ./python -c 'import logging'
Time (mean ± σ): 51.3 ms ± 0.8 ms [User: 47.3 ms, System: 3.9 ms]
Range (min … max): 49.8 ms … 53.7 ms 58 runs

Benchmark 7: ./python -c 'import pkgutil'
Time (mean ± σ): 51.1 ms ± 0.8 ms [User: 47.3 ms, System: 3.8 ms]
Range (min … max): 49.5 ms … 53.6 ms 58 runs

Benchmark 8: ./python -c 'import pydoc'
Time (mean ± σ): 85.8 ms ± 2.5 ms [User: 80.5 ms, System: 5.2 ms]
Range (min … max): 84.4 ms … 99.8 ms 35 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 9: ./python -c 'import rlcompleter'
Time (mean ± σ): 60.6 ms ± 0.8 ms [User: 55.8 ms, System: 4.6 ms]
Range (min … max): 59.2 ms … 63.9 ms 49 runs

Benchmark 10: ./python -c 'import ssl'
Time (mean ± σ): 45.4 ms ± 1.7 ms [User: 41.3 ms, System: 4.0 ms]
Range (min … max): 43.9 ms … 58.1 ms 65 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 11: ./python -c 'import tempfile'
Time (mean ± σ): 46.1 ms ± 1.7 ms [User: 41.8 ms, System: 4.2 ms]
Range (min … max): 44.3 ms … 58.2 ms 65 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 12: ./python -c 'import traceback'
Time (mean ± σ): 42.4 ms ± 0.8 ms [User: 38.7 ms, System: 3.4 ms]
Range (min … max): 40.4 ms … 44.3 ms 70 runs

Benchmark 13: ./python -c 'import urllib'
Time (mean ± σ): 22.9 ms ± 0.6 ms [User: 20.4 ms, System: 2.4 ms]
Range (min … max): 22.0 ms … 24.8 ms 122 runs

Benchmark 14: ./python -c 'import xml'
Time (mean ± σ): 24.6 ms ± 1.4 ms [User: 22.1 ms, System: 2.4 ms]
Range (min … max): 22.2 ms … 33.0 ms 126 runs

Summary
./python -c 'import zipimport' ran
1.01 ± 0.04 times faster than ./python -c 'import urllib'
1.01 ± 0.07 times faster than ./python -c 'import importlib'
1.04 ± 0.06 times faster than ./python -c 'import codeop'
1.09 ± 0.07 times faster than ./python -c 'import xml'
1.16 ± 0.05 times faster than ./python -c 'import hmac'
1.21 ± 0.05 times faster than ./python -c 'import ctypes'
1.88 ± 0.07 times faster than ./python -c 'import traceback'
2.01 ± 0.10 times faster than ./python -c 'import ssl'
2.04 ± 0.10 times faster than ./python -c 'import tempfile'
2.26 ± 0.08 times faster than ./python -c 'import pkgutil'
2.27 ± 0.09 times faster than ./python -c 'import logging'
2.68 ± 0.10 times faster than ./python -c 'import rlcompleter'
3.80 ± 0.17 times faster than ./python -c 'import pydoc'

Second experiment in PR branch

➜  cpython git:(issue-118761) ✗ hyperfine --warmup 11 "./python -c 'import codeop'" "./python -c 'import zipimport'" "./python -c 'import ctypes'" "./python -c 'import hmac'" "./python -c 'import importlib'" "./python -c 'import logging'" "./python -c 'import pkgutil'" "./python -c 'import pydoc'" "./python -c 'import rlcompleter'" "./python -c 'import ssl'" "./python -c 'import tempfile'" "./python -c 'import traceback'" "./python -c 'import urllib'" "./python -c 'import xml'"
Benchmark 1: ./python -c 'import codeop'
  Time (mean ± σ):      23.7 ms ±   1.0 ms    [User: 21.0 ms, System: 2.6 ms]
  Range (min … max):    22.7 ms …  31.0 ms    122 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: ./python -c 'import zipimport'
Time (mean ± σ): 22.6 ms ± 0.5 ms [User: 20.1 ms, System: 2.4 ms]
Range (min … max): 21.7 ms … 24.0 ms 126 runs

Benchmark 3: ./python -c 'import ctypes'
Time (mean ± σ): 27.6 ms ± 0.5 ms [User: 24.7 ms, System: 2.8 ms]
Range (min … max): 26.5 ms … 28.9 ms 104 runs

Benchmark 4: ./python -c 'import hmac'
Time (mean ± σ): 26.5 ms ± 1.0 ms [User: 23.2 ms, System: 3.2 ms]
Range (min … max): 25.4 ms … 33.1 ms 111 runs

Benchmark 5: ./python -c 'import importlib'
Time (mean ± σ): 23.0 ms ± 0.7 ms [User: 20.6 ms, System: 2.4 ms]
Range (min … max): 22.1 ms … 25.5 ms 121 runs

Benchmark 6: ./python -c 'import logging'
Time (mean ± σ): 51.5 ms ± 0.9 ms [User: 47.2 ms, System: 4.2 ms]
Range (min … max): 49.9 ms … 54.6 ms 58 runs

Benchmark 7: ./python -c 'import pkgutil'
Time (mean ± σ): 51.9 ms ± 1.4 ms [User: 47.8 ms, System: 4.0 ms]
Range (min … max): 49.7 ms … 58.4 ms 57 runs

Benchmark 8: ./python -c 'import pydoc'
Time (mean ± σ): 88.1 ms ± 2.2 ms [User: 82.1 ms, System: 5.8 ms]
Range (min … max): 85.1 ms … 93.3 ms 34 runs

Benchmark 9: ./python -c 'import rlcompleter'
Time (mean ± σ): 63.6 ms ± 3.5 ms [User: 58.6 ms, System: 4.9 ms]
Range (min … max): 59.4 ms … 76.9 ms 38 runs

Benchmark 10: ./python -c 'import ssl'
Time (mean ± σ): 50.6 ms ± 1.5 ms [User: 46.2 ms, System: 4.3 ms]
Range (min … max): 48.9 ms … 60.0 ms 60 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 11: ./python -c 'import tempfile'
Time (mean ± σ): 50.7 ms ± 0.8 ms [User: 45.7 ms, System: 4.8 ms]
Range (min … max): 49.1 ms … 53.1 ms 59 runs

Benchmark 12: ./python -c 'import traceback'
Time (mean ± σ): 54.3 ms ± 3.5 ms [User: 49.3 ms, System: 4.9 ms]
Range (min … max): 46.8 ms … 71.1 ms 63 runs

Benchmark 13: ./python -c 'import urllib'
Time (mean ± σ): 30.0 ms ± 0.6 ms [User: 26.9 ms, System: 3.0 ms]
Range (min … max): 28.4 ms … 32.0 ms 97 runs

Benchmark 14: ./python -c 'import xml'
Time (mean ± σ): 29.9 ms ± 0.7 ms [User: 26.7 ms, System: 3.1 ms]
Range (min … max): 28.4 ms … 32.1 ms 100 runs

Summary
./python -c 'import zipimport' ran
1.02 ± 0.04 times faster than ./python -c 'import importlib'
1.05 ± 0.05 times faster than ./python -c 'import codeop'
1.17 ± 0.05 times faster than ./python -c 'import hmac'
1.22 ± 0.04 times faster than ./python -c 'import ctypes'
1.32 ± 0.04 times faster than ./python -c 'import xml'
1.33 ± 0.04 times faster than ./python -c 'import urllib'
2.24 ± 0.08 times faster than ./python -c 'import ssl'
2.24 ± 0.06 times faster than ./python -c 'import tempfile'
2.28 ± 0.06 times faster than ./python -c 'import logging'
2.30 ± 0.08 times faster than ./python -c 'import pkgutil'
2.40 ± 0.16 times faster than ./python -c 'import traceback'
2.82 ± 0.17 times faster than ./python -c 'import rlcompleter'
3.90 ± 0.13 times faster than ./python -c 'import pydoc'

  • Issue: Improve import time of various stdlib modules #118761

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@donbarbos
Improve import time of codeop
acaa51c
@bedevere-app bedevere-app Bot added the awaiting review label Feb 7, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Feb 7, 2025
Improve import time of various stdlib modules #118761
Closed
@donbarbos
Always lazy import warnings
ca2f8bc
@donbarbos
donbarbos requested review from FFY00, brettcannon, ericsnowcurrently, gpshead, jaraco, ncoghlan, picnixz, vsajip and warsaw as code owners February 7, 2025 04:09
@donbarbos donbarbos changed the title gh-118761: Improve import time of codeop gh-118761: Improve import time by lazy import of warnings Feb 7, 2025
@donbarbos
Merge branch 'main' into issue-118761
4c9fa23
Wulian233
Wulian233 reviewed Feb 7, 2025
View reviewed changes
Comment thread Misc/NEWS.d/next/Library/2025-02-07-05-55-08.gh-issue-118761.aayL_A.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

donbarbos and others added 2 commits February 7, 2025 04:45
@donbarbos @Wulian233
Update Misc/NEWS.d/next/Library/2025-02-07-05-55-08.gh-issue-118761.a…
f88c5b1
…ayL_A.rst

Co-authored-by: Wulian233 <[email protected]>
@donbarbos
Correct my mistake
f1f77a5
vsajip
vsajip reviewed Feb 7, 2025
View reviewed changes
Comment thread Misc/NEWS.d/next/Library/2025-02-07-05-55-08.gh-issue-118761.aayL_A.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@picnixz

picnixz commented Feb 7, 2025

Copy link
Copy Markdown
Member

Thanks for doing this. I did it for hmac locally since I'm implementing the HACL* hmac nut it's good to see it done here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@donbarbos @vsajip
Update 2025-02-07-05-55-08.gh-issue-118761.aayL_A.rst
6210539
Co-authored-by: Vinay Sajip <[email protected]>
picnixz
picnixz requested changes Feb 7, 2025
View reviewed changes

@picnixz picnixz left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the whitespaces and unrelated new lines changes (unless the codeowners tell you that you can keep the changes though)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/codeop.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/codeop.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/hmac.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/hmac.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting changes and removed awaiting review labels Feb 7, 2025
@bedevere-app

bedevere-app Bot commented Feb 7, 2025

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner

AA-Turner commented Feb 7, 2025

Copy link
Copy Markdown
Member

We should verify that each change has non-noise benefits rather than changing everything at once in an omnibus PR. @donbarbos also please present your motivating statistics in a more readable manner, I expect to see a comparison of each module against baseline, rather than four large log outputs.

A

jaraco reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner AA-Turner added the DO-NOT-MERGE label Feb 7, 2025
@AA-Turner AA-Turner mentioned this pull request Feb 7, 2025
gh-118761: Improve import time by lazy import of traceback #129811
Closed
2 tasks done
donbarbos added 2 commits February 7, 2025 19:59
@donbarbos
Revert changing styles
212a25f
@donbarbos
Revert more
e976ca0
brettcannon
brettcannon requested changes Feb 12, 2025
View reviewed changes
Comment thread Lib/importlib/_bootstrap_external.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@donbarbos
Add suggestions
3e7f0ad
@brettcannon
brettcannon requested review from brettcannon and removed request for brettcannon February 12, 2025 22:07
@jaraco

jaraco commented Feb 17, 2025

Copy link
Copy Markdown
Member

I ran a test for importlib.resources, and this change if anything makes things worse:

 cpython issue-118761 🐚 hyperfine --warmup 11 "./python.exe -c 'import importlib.resources'"
Benchmark 1: ./python.exe -c 'import importlib.resources'
  Time (mean ± σ):      26.6 ms ±   0.5 ms    [User: 20.9 ms, System: 3.8 ms]
  Range (min … max):    25.4 ms …  28.7 ms    101 runs
 
 cpython issue-118761 [1] 🐚 git checkout @$(git merge-base HEAD main)
HEAD is now at 0fef47e5bbd gh-55454: Add IMAP4 IDLE support to imaplib (#122542)
 cpython 0fef47e5bbd 🐚 hyperfine --warmup 11 "./python.exe -c 'import importlib.resources'"
Benchmark 1: ./python.exe -c 'import importlib.resources'
  Time (mean ± σ):      25.9 ms ±   0.6 ms    [User: 21.4 ms, System: 3.8 ms]
  Range (min … max):    24.8 ms …  27.6 ms    98 runs

Sounds like we should revert those changes from this PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner

AA-Turner commented Feb 17, 2025

Copy link
Copy Markdown
Member

I'll close this PR as the contributor has opened some smaller individual changes.

A

donbarbos reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner AA-Turner closed this Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vsajip vsajip vsajip left review comments
@brettcannon brettcannon brettcannon requested changes
@picnixz picnixz picnixz requested changes
@jaraco jaraco Awaiting requested review from jaraco jaraco is a code owner
@warsaw warsaw Awaiting requested review from warsaw warsaw is a code owner
@FFY00 FFY00 Awaiting requested review from FFY00 FFY00 is a code owner
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@ncoghlan ncoghlan Awaiting requested review from ncoghlan
@gpshead gpshead Awaiting requested review from gpshead gpshead is a code owner
+1 more reviewer
@Wulian233 Wulian233 Wulian233 left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting changes DO-NOT-MERGE

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@donbarbos @picnixz @AA-Turner @jaraco @brettcannon @vsajip @Wulian233
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.