Skip to content

🧼 generate compact wcwidth tables#49

Open
natemoo-re wants to merge 13 commits into
mainfrom
ref/wcwidth
Open

🧼 generate compact wcwidth tables#49
natemoo-re wants to merge 13 commits into
mainfrom
ref/wcwidth

Conversation

@natemoo-re
Copy link
Copy Markdown
Member

@natemoo-re natemoo-re commented May 28, 2026

Building on #35, reduces npm install size again:

  • replaces the src/wcwidth.c implementation borrowed from termbox2 (~1,200 lines) with optimized tables generated by tasks/gen-wcwidth.ts
  • tables are generated from official Unicode spec, only tracks the size of wide characters (width = 2) and zero-width characters (width = 0) instead of all ranges (width = 0 | 1 | 2)
  • adds a gen-wcwidth task to regenerate tables when Unicode data updates

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 28, 2026

Open in StackBlitz

npm i https://pkg.pr.new/clayterm@49

commit: 1ba3c7f

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq Bot commented May 28, 2026

Merging this PR will not alter performance

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 21 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation long input burst (200 bytes) 576.5 µs 1,266.2 µs -54.47%
Simulation printable ASCII (single char) 174.5 µs 91.6 µs +90.51%

Tip

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


Comparing ref/wcwidth (1ba3c7f) with main (d75fb4b)

Open in CodSpeed

@natemoo-re

This comment was marked as outdated.

@natemoo-re natemoo-re marked this pull request as ready for review May 28, 2026 19:42
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

Size Reduced — -6.3 KB

100.9 KB unpacked

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