FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Speed up test_urlsplit_normalization by jacobtylerwalls · Pull Request #26688 · python/cpython · GitHub

/ cpython Public

Speed up test_urlsplit_normalization - #26688

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
jacobtylerwalls:urlsplit-test-speed
Jul 22, 2021
Merged

Speed up test_urlsplit_normalization#26688
serhiy-storchaka merged 1 commit into
python:mainfrom
jacobtylerwalls:urlsplit-test-speed

Conversation

jacobtylerwalls commented Jun 12, 2021
edited
Loading

Copy link
Copy Markdown
Contributor

Noticed while working on #26687 that one of the tests in test_urlparse took ~7s. Here I've short-circuited the filtering of a massive list comprehension (sys.maxunicode for me is 1,114,111) by checking if not empty before running split(), set(), &, etc.

LMK if this needs a ticket.


$ ./python.exe -m unittest test.test_urlparse.UrlParseTestCase.test_urlsplit_normalization

Before
Ran 1 test in 6.981s

After
Ran 1 test in 2.459s

corona10 left a comment
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

1108247 chars of 1113983 (99.4%) can use short-circuited pass on my local machine :)

corona10 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@serhiy-storchaka
I think that this PR is worth to review :) Can you please take a look?

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

github-actions Bot added the stale Stale PR or inactive for long period of time. label Jul 22, 2021

serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

serhiy-storchaka merged commit c0f2fcf into python:main Jul 22, 2021
sthagen added a commit to sthagen/python-cpython that referenced this pull request Jul 22, 2021
Speed up test_urlsplit_normalization (pythonGH-26688)

Copy link
Copy Markdown
Member

Thank you for your contribution @jacobtylerwalls.

jacobtylerwalls deleted the urlsplit-test-speed branch October 2, 2021 22:10
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

Labels

skip issue skip news stale Stale PR or inactive for long period of time. tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL