Skip to content

[mypyc] Only check a sample of non-BMP code points in str tests - #22448

Merged
JukkaL merged 1 commit into
python:masterfrom
Jahongir-Qurbonov:mypyc-sample-code-points
Nov 12, 2026
Merged

JukkaL merged 1 commit into
python:masterfrom
Jahongir-Qurbonov:mypyc-sample-code-points

Conversation

@Jahongir-Qurbonov

Copy link
Copy Markdown
Contributor

Follow-up to the review comment in #22407.

Tests for chr(), str.lower()/str.upper(), str.isspace(), str.isdigit() and the str.is* methods added in #22404 compared the result against the generic implementation for every code point (0 to 0x10FFFF), which is slow, especially through the generic code path.

Now these tests check all code points in the BMP, which covers the 1-byte and 2-byte string kinds, and every 97th code point above it, plus the largest code point. This is about 76K code points instead of 1.1M.

The same change is applied to the tests in #22405 and #22406.

Tests for chr() and several str methods compared the result against the
generic implementation for every code point, which is slow, especially
when using the generic implementation. Check all code points in the BMP,
which covers the 1-byte and 2-byte string kinds, and every 97th code
point above it (and the largest one).

@JukkaL JukkaL left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for helping with test performance!

@JukkaL
JukkaL merged commit a079a4f into python:master Nov 12, 2026
18 checks passed
@Jahongir-Qurbonov
Jahongir-Qurbonov deleted the mypyc-sample-code-points branch November 14, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants