René's URL Explorer Experiment


Title: mypy appears to become inefficient for nested ifs (13+ nested ifs) · Issue #9591 · python/mypy · GitHub

Open Graph Title: mypy appears to become inefficient for nested ifs (13+ nested ifs) · Issue #9591 · python/mypy

X Title: mypy appears to become inefficient for nested ifs (13+ nested ifs) · Issue #9591 · python/mypy

Description: Bug Report mypy appears to become inefficient for nested ifs (see example) To Reproduce Consider the following (bad) code example: cat << EOF > lint_me.py special_overrides = True print(sorted(["c", "b", "a"], key=lambda kv: kv[0] if not...

Open Graph Description: Bug Report mypy appears to become inefficient for nested ifs (see example) To Reproduce Consider the following (bad) code example: cat << EOF > lint_me.py special_overrides = True print(sorted(["c"...

X Description: Bug Report mypy appears to become inefficient for nested ifs (see example) To Reproduce Consider the following (bad) code example: cat << EOF > lint_me.py special_overrides = True print(so...

Opengraph URL: https://github.com/python/mypy/issues/9591

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mypy appears to become inefficient for nested ifs (13+ nested ifs)","articleBody":"\u003c!--\r\n  If you're new to mypy and you're not sure whether what you're experiencing is a mypy bug, please see the \"Question and Help\" form\r\n  instead.\r\n-->\r\n\r\n**Bug Report**\r\n\r\n\u003c!--\r\nNote: If the problem you are reporting is about a specific library function, then the typeshed tracker is better suited\r\nfor this report: https://github.com/python/typeshed/issues\r\n-->\r\nmypy appears to become inefficient for nested ifs (see example)\r\n\r\n**To Reproduce**\r\n\r\nConsider the following (bad) code example:\r\n```\r\ncat \u003c\u003c EOF > lint_me.py\r\nspecial_overrides = True\r\nprint(sorted([\"c\", \"b\", \"a\"], key=lambda kv: kv[0] if not special_overrides else \\\\\r\n                                       'a' if kv[0] == 'a_01' else \\\\\r\n                                       'b' if kv[0] == 'b_02' else \\\\\r\n                                       'c' if kv[0] == 'c_03' else \\\\\r\n                                       'd' if kv[0] == 'd_04' else \\\\\r\n                                       'e' if kv[0] == 'e_05' else \\\\\r\n                                       'f' if kv[0] == 'f_06' else \\\\\r\n                                       'g' if kv[0] == 'g_07' else \\\\\r\n                                       'h' if kv[0] == 'h_08' else \\\\\r\n                                       'i' if kv[0] == 'i_09' else \\\\\r\n                                       'j' if kv[0] == 'j_10' else \\\\\r\n                                       'k' if kv[0] == 'k_11' else \\\\\r\n                                       'l' if kv[0] == 'l_12' else \\\\\r\n                                       'm' if kv[0] == 'm_13' else \\\\\r\n                                       'n' if kv[0] == 'n_14' else \\\\\r\n                                       'o' if kv[0] == 'o_15' else \\\\\r\n                                       'p' if kv[0] == 'p_16' else \\\\\r\n                                       'q' if kv[0] == 'q_17' else \\\\\r\n                                       kv[0]))\r\nEOF\r\n```\r\n\r\n\r\n**Expected Behavior**\r\nmypy can complain about very bad code in a reasonable time\r\n\r\n**Actual Behavior**\r\nwith each additional `if` the total runtime seems to double:\r\n```\r\n13 nested ifs (until m): real    0m33.827s\r\n14 nested ifs (until n): real    1m10.013s\r\n15 nested ifs (until o): real    2m3.904s\r\n16 nested ifs (until p): real    4m3.223s\r\n17 nested ifs (until q): real    8m27.333s\r\n```\r\n\r\n**Your Environment**\r\n\r\n\u003c!-- Include as many relevant details about the environment you experienced the bug in -->\r\n\r\n- Mypy version used: `0.790`\r\n- Mypy command-line flags: None (just `python -m mypy lint_me.py`)\r\n- Mypy configuration options from `mypy.ini` (and other config files): None\r\n- Python version used: `Python 3.8.1`\r\n- Operating system and version: `Windows 10, Version 10.0.19041 Build 19041`\r\n","author":{"url":"https://github.com/stmlange","@type":"Person","name":"stmlange"},"datePublished":"2020-10-13T17:23:48Z","url":"https://github.com/python/mypy/issues/9591"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:7ada1feb-b8ba-68c5-df06-4ac353635e49
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBE82:1DD784:190B42:218D47:6B002011
html-safe-nonce34dbd17bbd8a2a3ee8f77c369bfd991a36c2d02196004cec0e0a072fe332cd2b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRTgyOjFERDc4NDoxOTBCNDI6MjE4RDQ3OjZCMDAyMDExIiwidmlzaXRvcl9pZCI6IjIwMTc3ODkxNDA4MzMxNDg5NDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac4577f41b73ec7dbc32b7197cca69173053151407507e97c1e55cdd03de2cc8c8
hovercard-subject-tagissue:720573857
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/9591/issue_layout
twitter:imagehttps://opengraph.githubassets.com/56678746c89b079e9b67042ab862cfa77bd4c97c440bd8868aca519391737fb5/python/mypy/issues/9591
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/56678746c89b079e9b67042ab862cfa77bd4c97c440bd8868aca519391737fb5/python/mypy/issues/9591
og:image:altBug Report mypy appears to become inefficient for nested ifs (see example) To Reproduce Consider the following (bad) code example: cat << EOF > lint_me.py special_overrides = True print(sorted(["c"...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamestmlange
hostnamegithub.com
expected-hostnamegithub.com
None4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0
turbo-cache-controlno-preview
go-importgithub.com/python/mypy git https://github.com/python/mypy.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id7053637
octolytics-dimension-repository_nwopython/mypy
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id7053637
octolytics-dimension-repository_network_root_nwopython/mypy
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release44c658b24abf00491fb7ae5f56d42c9f38cbeab2
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/9591#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F9591
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F9591
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fmypy
Reloadhttps://github.com/python/mypy/issues/9591
Reloadhttps://github.com/python/mypy/issues/9591
Reloadhttps://github.com/python/mypy/issues/9591
pythonhttps://github.com/python
mypyhttps://github.com/python/mypy
Codehttps://github.com/python/mypy
Issues2.7k (2.7k)https://github.com/python/mypy/issues
Pull requests546 (546)https://github.com/python/mypy/pulls
Actionshttps://github.com/python/mypy/actions
Projectshttps://github.com/python/mypy/projects
Wikihttps://github.com/python/mypy/wiki
Security and qualityhttps://github.com/python/mypy/security
Insightshttps://github.com/python/mypy/insights
https://github.com/python/mypy
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/9591
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/9591
#12700https://github.com/python/mypy/pull/12700
mypy appears to become inefficient for nested ifs (13+ nested ifs)https://github.com/python/mypy/issues/9591#top
#12700https://github.com/python/mypy/pull/12700
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
performancehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22performance%22
https://github.com/stmlange
stmlangehttps://github.com/stmlange
on Oct 13, 2020https://github.com/python/mypy/issues/9591#issue-720573857
stmlangehttps://github.com/stmlange
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
on Oct 13, 2020https://github.com/python/mypy/issues/9591#event-3872619352
https://github.com/PurvaT
PurvaThttps://github.com/PurvaT
on Oct 25, 2020https://github.com/python/mypy/issues/9591#issuecomment-716120140
https://github.com/stmlange
stmlangehttps://github.com/stmlange
on Oct 26, 2020https://github.com/python/mypy/issues/9591#issuecomment-716401394
https://github.com/PurvaT
PurvaThttps://github.com/PurvaT
on Oct 26, 2020https://github.com/python/mypy/issues/9591#issuecomment-716422086
https://github.com/stmlange
stmlangehttps://github.com/stmlange
on Oct 26, 2020https://github.com/python/mypy/issues/9591#issuecomment-716444629
https://github.com/emmatyping
emmatypinghttps://github.com/emmatyping
on Oct 26, 2020https://github.com/python/mypy/issues/9591#issuecomment-716531513
@PurvaThttps://github.com/PurvaT
https://github.com/dhananjay1210
dhananjay1210https://github.com/dhananjay1210
on Oct 27, 2020https://github.com/python/mypy/issues/9591#issuecomment-717121309
https://github.com/stmlange
stmlangehttps://github.com/stmlange
on Oct 27, 2020https://github.com/python/mypy/issues/9591#issuecomment-717125308
https://github.com/PurvaT
PurvaThttps://github.com/PurvaT
on Oct 27, 2020https://github.com/python/mypy/issues/9591#issuecomment-717136839
AlexWaygoodhttps://github.com/AlexWaygood
performancehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22performance%22
on Apr 1, 2022https://github.com/python/mypy/issues/9591#event-6354618933
huguesbhttps://github.com/huguesb
on Apr 30, 2022https://github.com/python/mypy/issues/9591#event-6527767295
speedup typechecking of nested if expressionshttps://github.com/huguesb/mypy/commit/b6585ffec1be5f2009556308e78c48f753d771a5
https://docs.github.com/articles/closing-issues-via-commit-messages
b6585ffhttps://github.com/huguesb/mypy/commit/b6585ffec1be5f2009556308e78c48f753d771a5
https://github.com/huguesb
huguesbhttps://github.com/huguesb
on Apr 30, 2022https://github.com/python/mypy/issues/9591#issuecomment-1113944750
#12700https://github.com/python/mypy/pull/12700
huguesbhttps://github.com/huguesb
on May 1, 2022https://github.com/python/mypy/issues/9591#event-6528903353
speedup typechecking of nested if expressionshttps://github.com/huguesb/mypy/commit/1f0741becc30795c10ef76b090c92e45d4fec1d9
https://docs.github.com/articles/closing-issues-via-commit-messages
1f0741bhttps://github.com/huguesb/mypy/commit/1f0741becc30795c10ef76b090c92e45d4fec1d9
huguesbhttps://github.com/huguesb
on May 16, 2022https://github.com/python/mypy/issues/9591#event-6613155226
speedup typechecking of nested if expressionshttps://github.com/huguesb/mypy/commit/2c0209edbba424a6dcdcbda1f0f0ab2fdf6b0fa6
https://docs.github.com/articles/closing-issues-via-commit-messages
2c0209ehttps://github.com/huguesb/mypy/commit/2c0209edbba424a6dcdcbda1f0f0ab2fdf6b0fa6
JukkaLhttps://github.com/JukkaL
completedhttps://github.com/python/mypy/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#12700https://github.com/python/mypy/pull/12700
on May 20, 2022https://github.com/python/mypy/issues/9591#event-6651706427
JukkaLhttps://github.com/JukkaL
on May 20, 2022https://github.com/python/mypy/issues/9591#event-6651706851
speedup typechecking of nested if expressions (#12700)https://github.com/python/mypy/commit/e93be734f4ca51f88f0b46e5c089014e712e1d11
#12700https://github.com/python/mypy/pull/12700
https://docs.github.com/articles/closing-issues-via-commit-messages
e93be73https://github.com/python/mypy/commit/e93be734f4ca51f88f0b46e5c089014e712e1d11
speedup typechecking of nested if expressions (#12700)https://github.com/python/mypy/commit/b673366df0b0ee859abe0de3e2e82d99203fcd84
#12700https://github.com/python/mypy/pull/12700
https://docs.github.com/articles/closing-issues-via-commit-messages
b673366https://github.com/python/mypy/commit/b673366df0b0ee859abe0de3e2e82d99203fcd84
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/9591
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/9591
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
performancehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22performance%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.