Skip to content

Unicode 18.0.0 support, releases soonish - #238

Merged
jquast merged 9 commits into
masterfrom
jq/unicode-18
Sep 16, 2026
Merged

jquast merged 9 commits into
masterfrom
jq/unicode-18

Conversation

@jquast

@jquast jquast commented Aug 31, 2026 •

Copy link
Copy Markdown
Owner

We expect Unicode 18.0 to release today.

  • Match new 18.0.0 UAX #20 rules on grapheme clustering InCB/Indic_Conjunct_Break
  • parse names from unicode.org data instead of current python
  • wcstwidth() correction table updated with latest ucs-detect results (contour and rio are better-conforming)
  • skip "bad results" from ucs-detect (delta_y movement in CPR, iTerm2, from correction tables)
  • correction table file hashes are now deterministic (don't use repr() for hashing -- write our own)

@codspeed

codspeed Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 31.4%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 27 regressed benchmarks
✅ 89 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ test_iter_graphemes_combining 76.6 µs 286.6 µs -73.27%
❌ test_iter_graphemes_emoji 42.5 µs 112.3 µs -62.12%
❌ test_iter_graphemes_ascii 46.4 µs 107.4 µs -56.83%
❌ test_clip_cursor_cr_control_codes_ignore 341.9 µs 604.3 µs -43.42%
❌ test_clip_cursor_cr_overwrite 1.8 ms 2.8 ms -37.67%
❌ test_clip_cursor_cr_to_end 1.8 ms 2.8 ms -36.87%
❌ test_clip_long_cjk_overtype 7.5 ms 11.6 ms -35.33%
❌ test_clip_long_cjk_to_end 7.7 ms 11.8 ms -34.9%
❌ test_clip_dense_ansi_to_end_no_propagate 6.8 ms 10.1 ms -32.69%
❌ test_clip_long_cjk_past_window 326.1 µs 477.2 µs -31.68%
❌ test_clip_cursor_csi_backward 573.1 µs 834.1 µs -31.29%
❌ test_clip_long_cjk_control_codes_ignore 330.3 µs 479.6 µs -31.13%
❌ test_clip_complex_sgr_no_overtype 180.3 µs 244.8 µs -26.35%
❌ test_clip_dense_ansi_to_end 9.2 ms 12.4 ms -26.35%
❌ test_clip_complex_sgr 186.9 µs 252.1 µs -25.84%
❌ test_clip_japanese_to_end 102.5 µs 135.9 µs -24.59%
❌ test_clip_dense_ansi_control_codes_ignore 420.6 µs 537.5 µs -21.76%
❌ test_clip_dense_ansi_no_overtype 421 µs 536.9 µs -21.58%
❌ test_clip_japanese 97.7 µs 124.1 µs -21.27%
❌ test_clip_dense_ansi_overtype 546.7 µs 662.4 µs -17.47%
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing jq/unicode-18 (70aa0cd) with master (85cc473)

Open in CodSpeed

@jquast

jquast commented Sep 15, 2026

Copy link
Copy Markdown
Owner Author

The remaining test failure is because the 3.14 step also runs "tox -e fetch" but without the new --draft argument that was used, it can be ignored.

Unicode 18 releases today, so this could be merged and released as soon as end of day.

@jquast
jquast marked this pull request as ready for review September 15, 2026 07:01
@jquast jquast changed the title Unicode 18 preview (draft) Unicode 18.0.0 support, releases today Sep 15, 2026
@jquast

jquast commented Sep 15, 2026 •

Copy link
Copy Markdown
Owner Author

I have reverted to the python-only version of iter_graphemes(), as I can't say for sure if or when standard python's unicodedata.iter_graphemes will be fixed for the InCB/Indic_Conjunct_Break rules changed in unicode 18, so this is expected to degrade performance for any grapheme-related functions.

@jquast
jquast changed the base branch from master to jq/libwcwidth-rc September 15, 2026 11:27
jquast added a commit that referenced this pull request Sep 15, 2026
Implements C Python wrapper of our C11 iter_graphemes(), previous to
#238 we used std python's
iter_graphemes, but, as i wrote:

> I can't say for sure if or when standard python's
> unicodedata.iter_graphemes will be fixed for the
> InCB/Indic_Conjunct_Break rules changed in unicode 18, so this is
> expected to degrade performance for any grapheme-related functions.

And so it seems we should implement a C Python shim to our own
iter_graphemes(), so that we support Unicode 18 on all python versions
equally by our own up-to-date impl.
@jquast
jquast added this pull request to stack #249 September 15, 2026 13:18
jquast added a commit that referenced this pull request Sep 15, 2026
Implements C Python wrapper of our C11 iter_graphemes(), previous to
#238 we used std python's
iter_graphemes, but, as i wrote:

> I can't say for sure if or when standard python's
> unicodedata.iter_graphemes will be fixed for the
> InCB/Indic_Conjunct_Break rules changed in unicode 18, so this is
> expected to degrade performance for any grapheme-related functions.

And so it seems we should implement a C Python shim to our own
iter_graphemes(), so that we support Unicode 18 on all python versions
equally by our own up-to-date impl.
@codecov

codecov Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (85cc473) to head (70aa0cd).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #238   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines         2004      1980   -24     
  Branches       469       462    -7     
=========================================
- Hits          2004      1980   -24     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

jquast added a commit that referenced this pull request Sep 15, 2026
Implements C Python wrapper of our C11 iter_graphemes(), previous to
#238 we used std python's
iter_graphemes, but, as i wrote:

> I can't say for sure if or when standard python's
> unicodedata.iter_graphemes will be fixed for the
> InCB/Indic_Conjunct_Break rules changed in unicode 18, so this is
> expected to degrade performance for any grapheme-related functions.

And so it seems we should implement a C Python shim to our own
iter_graphemes(), so that we support Unicode 18 on all python versions
equally by our own up-to-date impl.
@jquast

jquast commented Sep 15, 2026

Copy link
Copy Markdown
Owner Author

The performance loss of iter_graphemes() is returned and improved by C11 integration in PR #248 It appears our C11-based iter_graphemes() is several times faster than C Python's

Base automatically changed from jq/libwcwidth-rc to master September 15, 2026 21:45
Regenerate all tables for Unicode 18.0.0, and refresh the ucs-detect terminal
override tables from the latest results.  UAX #29 revision 48 relaxes GB9c: the
leading \p{InCB=Consonant} requirement was dropped, so a linker no longer needs
a consonant before it to join the following consonant.  Revert to our own
iter_graphemes() rather than python3.15's stdlib, which differs in subtle
negative ways; the performance is planned to return by way of the libwcwidth
C11 library.

Two generator fixes come along.  Measurements carrying 'delta_ypos' or an
out-of-range width are now discarded instead of becoming override widths --
iterm2 reports -88 for five Burmese clusters.  And the shared grapheme override
tables are named by a codepoint digest rather than by hashing repr() of the
cluster, which escapes characters the *running* interpreter's unicodedata
considers unassigned and so made the generated _known_* filenames depend on
which Python ran the generator.  All _known_* files are renamed once.

Unicode 18.0 is still pre-release, so bin/update-tables.py grows a --draft
argument to fetch the draft data files.  CI does not pass it; instead, a
GraphemeBreakTest.txt fixture older than our tables now skips those tests
rather than failing them.
jquast added a commit that referenced this pull request Sep 15, 2026
Implements C Python wrapper of our C11 iter_graphemes(), previous to
#238 we used std python's
iter_graphemes, but, as i wrote:

> I can't say for sure if or when standard python's
> unicodedata.iter_graphemes will be fixed for the
> InCB/Indic_Conjunct_Break rules changed in unicode 18, so this is
> expected to degrade performance for any grapheme-related functions.

And so it seems we should implement a C Python shim to our own
iter_graphemes(), so that we support Unicode 18 on all python versions
equally by our own up-to-date impl.
@jquast jquast changed the title Unicode 18.0.0 support, releases today Unicode 18.0.0 support, releases soonish Sep 15, 2026
Comment thread tests/test_grapheme.py
_skipif_skew = pytest.mark.skipif(
_SKEW_OLDER,
reason="GraphemeBreakTest.txt is Unicode {} but tables are {}; unicode.org has not "
"published the final fixture yet".format(*(_SKEW or ('', ''))))

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

todo: we should be able to delete this

@jquast

jquast commented Sep 16, 2026

Copy link
Copy Markdown
Owner Author

Unicode 18.0 released today, no changes in data files were found from the draft release.

@jquast
jquast merged commit adac690 into master Sep 16, 2026
35 of 36 checks passed
@jquast
jquast deleted the jq/unicode-18 branch September 16, 2026 19:33
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.

1 participant