Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase allowed import time for Python 3.12+ #10342

Merged
merged 1 commit into from
Jan 20, 2025
Merged

Increase allowed import time for Python 3.12+ #10342

merged 1 commit into from
Jan 20, 2025

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Jan 20, 2025

I took a look at the import waterfall using https://github.com/asottile/importtime-waterfall and did not find anything that we could reduce or unexpected imports.

aiohttp (105)
  typing (944)
    collections.abc (61)
    _typing (14)
  aiohttp.hdrs (167)
    multidict (67)
      multidict._abc (127)
      multidict._compat (174)
        platform (260)
          _wmi (27)
        multidict._multidict (216)
          multidict._multidict_base (55)
  aiohttp.client (770)
    asyncio (90)
      asyncio.base_events (336)
        concurrent.futures (73)
          concurrent (54)
          concurrent.futures._base (321)
            logging (575)
              traceback (241)
                textwrap (315)
                warnings (138)
                contextlib (228)
                _colorize (75)
              weakref (237)
                _weakrefset (81)
              string (210)
                _string (11)
              threading (226)
              atexit (14)
        errno (25)
        heapq (79)
          _heapq (147)
        socket (417)
          _socket (305)
          selectors (196)
            math (230)
            select (189)
          array (175)
        subprocess (342)
          locale (321)
            _locale (25)
          signal (189)
          fcntl (164)
          msvcrt (34)
          _posixsubprocess (195)
        ssl (746)
          _ssl (1250)
          base64 (112)
            struct (52)
              _struct (192)
            binascii (176)
        asyncio.constants (97)
        asyncio.coroutines (57)
          inspect (672)
            ast (475)
              _ast (600)
            dis (320)
              opcode (125)
                _opcode (169)
                _opcode_metadata (87)
            tokenize (296)
              token (67)
              _tokenize (15)
        asyncio.events (291)
          contextvars (50)
            _contextvars (158)
          asyncio.format_helpers (54)
          _asyncio (226)
            asyncio.base_futures (49)
            asyncio.exceptions (82)
            asyncio.base_tasks (51)
        asyncio.futures (84)
        asyncio.protocols (74)
        asyncio.sslproto (219)
          asyncio.transports (99)
          asyncio.log (43)
        asyncio.staggered (66)
          asyncio.locks (167)
            asyncio.mixins (42)
          asyncio.tasks (161)
            asyncio.queues (95)
            asyncio.timeouts (158)
        asyncio.trsock (59)
      asyncio.runners (103)
      asyncio.streams (988)
      asyncio.subprocess (96)
      asyncio.taskgroups (66)
      asyncio.threads (43)
      asyncio.unix_events (258)
        asyncio.base_subprocess (93)
        asyncio.selector_events (187)
    dataclasses (236)
      copy (73)
    hashlib (122)
      _hashlib (800)
      _blake2 (187)
    json (93)
      json.decoder (165)
        json.scanner (125)
          _json (180)
      json.encoder (139)
    yarl (70)
      yarl._query (213)
        yarl._quoters (67)
          urllib.parse (391)
            urllib (48)
            ipaddress (428)
          yarl._quoting (54)
            yarl._quoting_c (239)
      yarl._url (430)
        idna (70)
          idna.package_data (58)
          idna.core (240)
            idna.idnadata (92)
            bisect (58)
              _bisect (170)
            unicodedata (302)
            idna.intranges (67)
        propcache.api (65)
          propcache (69)
          propcache._helpers (43)
            propcache._helpers_c (201)
        yarl._parse (71)
        yarl._path (45)
    aiohttp.http (62)
      aiohttp.http_exceptions (142)
        aiohttp.typedefs (192)
      aiohttp.http_parser (631)
        aiohttp.base_protocol (70)
          aiohttp.client_exceptions (358)
          aiohttp.helpers (1669)
            datetime (52)
              _datetime (230)
            netrc (87)
            email.parser (106)
              email (59)
              email.feedparser (311)
                email.errors (188)
                email._policybase (118)
                  email.header (217)
                    email.quoprimime (84)
                    email.base64mime (48)
                    email.charset (73)
                      email.encoders (43)
                        quopri (61)
                  email.utils (155)
                    email._parseaddr (88)
            http.cookies (435)
              http (237)
            pathlib (68)
              pathlib._abc (187)
                glob (173)
                  fnmatch (152)
              pathlib._local (200)
                ntpath (92)
                  _winapi (29)
                  nt (30)
                  nt (26)
                  nt (28)
                  nt (24)
                  nt (25)
                  nt (24)
                  nt (24)
                pwd (18)
                grp (202)
            urllib.request (477)
              http.client (325)
                email.message (169)
                  email._encoded_words (88)
                  email.iterators (46)
              tempfile (299)
                shutil (243)
                  zlib (213)
                  bz2 (97)
                    _compression (79)
                    _bz2 (192)
                  lzma (98)
                    _lzma (330)
                random (177)
                  _random (194)
              urllib.error (93)
                urllib.response (69)
              _scproxy (210)
            aiohttp.log (52)
          aiohttp.tcp_helpers (54)
        aiohttp.compression_utils (97)
          brotlicffi (28)
          brotli (57)
            _brotli (237)
        aiohttp.http_writer (203)
          aiohttp.abc (211)
          aiohttp._http_writer (15)
        aiohttp.streams (209)
        aiohttp._http_parser (17)
      aiohttp.http_websocket (53)
        aiohttp._websocket.helpers (251)
          aiohttp._websocket (36)
          aiohttp._websocket.models (697)
          aiohttp._websocket.mask (18)
        aiohttp._websocket.reader (50)
          aiohttp._websocket.reader_c (119)
        aiohttp._websocket.writer (80)
    aiohttp.payload (338)
      mimetypes (116)
        _winapi (26)
        winreg (29)
    aiohttp.client_reqrep (895)
      aiohttp.multipart (358)
        uuid (152)
          _uuid (224)
      aiohttp.formdata (74)
    aiohttp.client_ws (324)
    aiohttp.connector (6472)
      aiohappyeyeballs (67)
        aiohappyeyeballs.impl (126)
          aiohappyeyeballs._staggered (86)
          aiohappyeyeballs.types (58)
        aiohappyeyeballs.utils (97)
      aiohttp.client_proto (94)
      aiohttp.resolver (93)
        aiodns (124)
          pycares (292)
            pycares._cares (333)
              _cffi_backend (374)
            pycares.errno (58)
              pycares.utils (38)
            pycares._version (35)
          aiodns.error (73)
    aiohttp.cookiejar (537)
      calendar (330)
      pickle (343)
        _compat_pickle (102)
        _pickle (309)
    aiohttp.tracing (2457)
      aiosignal (92)
        frozenlist (111)
          frozenlist._frozenlist (311)

I took a look at the import waterfall using https://github.com/asottile/importtime-waterfall
and did not find anything that we could reduce or unexpected imports.
@bdraco bdraco requested a review from asvetlov as a code owner January 20, 2025 19:43
@bdraco bdraco added bot:chronographer:skip This PR does not need to include a change note backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot backport-3.12 Trigger automatic backporting to the 3.12 release branch by Patchback robot labels Jan 20, 2025
Copy link

codecov bot commented Jan 20, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
3463 1 3462 92
View the top 1 failed tests by shortest run time
tests.test_web_runner test_runner_setup_without_signal_handling[pyloop]
Stack Traces | 0.101s run time
make_runner = <function make_runner.<locals>.go at 0x7f14cd6f3f40>

    #x1B[0m#x1B[37m@pytest#x1B[39;49;00m.mark.skipif(#x1B[90m#x1B[39;49;00m
        platform.system() == #x1B[33m"#x1B[39;49;00m#x1B[33mWindows#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m, reason=#x1B[33m"#x1B[39;49;00m#x1B[33mthe test is not valid for Windows#x1B[39;49;00m#x1B[33m"#x1B[39;49;00m#x1B[90m#x1B[39;49;00m
    )#x1B[90m#x1B[39;49;00m
    #x1B[94masync#x1B[39;49;00m #x1B[94mdef#x1B[39;49;00m#x1B[90m #x1B[39;49;00m#x1B[92mtest_runner_setup_without_signal_handling#x1B[39;49;00m(make_runner: _RunnerMaker) -> #x1B[94mNone#x1B[39;49;00m:#x1B[90m#x1B[39;49;00m
        runner = make_runner(handle_signals=#x1B[94mFalse#x1B[39;49;00m)#x1B[90m#x1B[39;49;00m
        #x1B[94mawait#x1B[39;49;00m runner.setup()#x1B[90m#x1B[39;49;00m
>       #x1B[94massert#x1B[39;49;00m signal.getsignal(signal.SIGTERM) #x1B[95mis#x1B[39;49;00m signal.SIG_DFL#x1B[90m#x1B[39;49;00m
#x1B[1m#x1B[31mE       assert <function Proxy._handle_exit_signal at 0x7f14cf902f80> is <Handlers.SIG_DFL: 0>#x1B[0m
#x1B[1m#x1B[31mE        +  where <function Proxy._handle_exit_signal at 0x7f14cf902f80> = <function getsignal at 0x7f14d8b93760>(<Signals.SIGTERM: 15>)#x1B[0m
#x1B[1m#x1B[31mE        +    where <function getsignal at 0x7f14d8b93760> = signal.getsignal#x1B[0m
#x1B[1m#x1B[31mE        +    and   <Signals.SIGTERM: 15> = signal.SIGTERM#x1B[0m
#x1B[1m#x1B[31mE        +  and   <Handlers.SIG_DFL: 0> = signal.SIG_DFL#x1B[0m

make_runner = <function make_runner.<locals>.go at 0x7f14cd6f3f40>
runner     = <aiohttp.web_runner.AppRunner object at 0x7f14cf599a80>

#x1B[1m#x1B[31mtests/test_web_runner.py#x1B[0m:65: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

Copy link

codspeed-hq bot commented Jan 20, 2025

CodSpeed Performance Report

Merging #10342 will not alter performance

Comparing import_time (e660270) with master (089e7de)

Summary

✅ 47 untouched benchmarks

@bdraco bdraco enabled auto-merge (squash) January 20, 2025 19:53
@bdraco bdraco merged commit 755299d into master Jan 20, 2025
42 checks passed
@bdraco bdraco deleted the import_time branch January 20, 2025 19:59
Copy link
Contributor

patchback bot commented Jan 20, 2025

Backport to 3.11: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.11/755299d0be793c553524859f1ee74204a59a119f/pr-10342

Backported as #10343

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Jan 20, 2025
Copy link
Contributor

patchback bot commented Jan 20, 2025

Backport to 3.12: 💚 backport PR created

✅ Backport PR branch: patchback/backports/3.12/755299d0be793c553524859f1ee74204a59a119f/pr-10342

Backported as #10344

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@Dreamsorcerer
Copy link
Member

I thought it was only the 3.11 branch that was slower for some reason..

@bdraco
Copy link
Member Author

bdraco commented Jan 21, 2025

Here is 3.11
3.11.txt

Here is master
master.txt

@bdraco
Copy link
Member Author

bdraco commented Jan 21, 2025

Also 3.11 after blowing away the venv and starting again
3.11.txt

@bdraco
Copy link
Member Author

bdraco commented Jan 21, 2025

I didn't see anything obvious thats significantly worse on 3.11 but the margin of error between runs is quite high. It seems like its more of a cumulative effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot backport-3.12 Trigger automatic backporting to the 3.12 release branch by Patchback robot bot:chronographer:skip This PR does not need to include a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants