Skip to content

Conversation

@jquast
Copy link
Owner

@jquast jquast commented Jan 29, 2026

CLoses #133 and #154.

This decreases general performance by ~10% for complex CJK/combining and emoji strings.

  • Regional Indicator pairs measured as one 2-cell flag; unpaired RI measured individually
  • Fitzpatrick skin tone modifiers are zero-width when following an emoji base, Narrow when "standalone"

But i think that's ok -- mainly: we describe the specification of our
wcwidth() and wcswidth() function. This includes that stuff.
I'll say, there are uses downstream, I see silly lines like:
for cp in range(1000000):
  if wcwidth.wcwidth(cp) == 2:
    wide_table.append(cp)

and they're going to suffer a bit from this, or they also benefit,
depending on context, but if they're "doing it wrong" they're probably
also not using iter_graphemes() anyway so there is no help
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 29, 2026

CodSpeed Performance Report

Merging this PR will degrade performance by 22.14%

Comparing jq/standalone-modifiers (7e265fa) with master (8c8eac8)

Summary

❌ 8 regressed benchmarks
✅ 48 untouched benchmarks
🆕 4 new benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 test_wcswidth_ri_flags_unpaired N/A 87.9 ms N/A
test_width_udhr_lines 263 ms 294.5 ms -10.7%
test_width_wcswidth_consistency_udhr 386.8 ms 440.5 ms -12.21%
🆕 test_wcswidth_ri_flags_paired N/A 371.5 ms N/A
test_ljust_udhr_lines 265.9 ms 297.4 ms -10.61%
🆕 test_width_ri_flags_paired N/A 371.7 ms N/A
test_width_composed 1.6 ms 1.9 ms -12.85%
test_wcswidth_long_japanese 231 µs 267.1 µs -13.52%
test_wcswidth_composed 1.4 ms 1.7 ms -14.5%
test_wcswidth_decomposed 2.2 ms 2.4 ms -10.57%
test_wcswidth_emoji_sequence 47.4 µs 60.8 µs -22.14%
🆕 test_width_ri_flags_unpaired N/A 88 ms N/A

@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (8c8eac8) to head (7e265fa).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #202   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           15        15           
  Lines          896       938   +42     
  Branches       227       239   +12     
=========================================
+ Hits           896       938   +42     

☔ View full report in Codecov by Sentry.
📢 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 jquast marked this pull request as ready for review January 29, 2026 17:57
@jquast jquast merged commit 38d03a5 into master Jan 29, 2026
39 checks passed
@jquast jquast deleted the jq/standalone-modifiers branch January 29, 2026 18:52
jquast added a commit to jquast/blessed that referenced this pull request Feb 1, 2026
The boundary pattern in ``get_kitty_keyboard_state()`` used ``.+`` which matched prematurely!

Existing tests didn't catch this because they use ungetch() which buffers the entire response

jquast/wcwidth#200
jquast/wcwidth#202
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.

Emoji: Skin tone modifiers used in isolation

1 participant