Skip to content

wc: consider word join identifier as a seperator by default - #16934

Open
Saumya40-codes wants to merge 2 commits into
uutils:mainfrom
Saumya40-codes:fix/wc-word-joiner
Open

Saumya40-codes wants to merge 2 commits into
uutils:mainfrom
Saumya40-codes:fix/wc-word-joiner

Conversation

@Saumya40-codes

@Saumya40-codes Saumya40-codes commented Nov 28, 2026 •

Copy link
Copy Markdown

This PR treats the word joiner identifier U+2060 as a seperator by default for UTF-8 locales, unless POSIXLY_CORRECT=1 is set, which matches the behaviour for which I've also added the tests for this small patch.

Closes #16933

@codspeed

codspeed Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 6.44%

1 warning

⚠️ 11 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚡ 2 improved benchmarks
✅ 20 untouched benchmarks
⏩ 480 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ CPU Simulation wc_words_synthetic[2000] 10 s 9.4 s +6.86%
⚡ CPU Simulation wc_words_large_line_count[100000] 46.3 ms 43.6 ms +6.03%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing Saumya40-codes:fix/wc-word-joiner (29e6063) with main (48819c9)

Open in CodSpeed

Footnotes

  1. 480 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Comment thread src/uu/wc/src/wc.rs Outdated
let mut in_word = false;
let mut current_len = 0;
let is_posixly_correct = *IS_POSIXLY_CORRECT;
let is_utf8 = SHOW_WORDS && locale_encoding() == Encoding::Utf8;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could be computed once in Settings, next to count_chars_as_bytes, no?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes, updated in the last commit.

Signed-off-by: Saumya Shah <saumyabshah90@gmail.com>

wc: consider word joiner case only for utf-8 locales

Signed-off-by: Saumya Shah <saumyabshah90@gmail.com>
Signed-off-by: Saumya Shah <saumyabshah90@gmail.com>

This branch has not been deployed

No deployments
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.

wc -w does not treat U+2060 WORD JOINER as a separator by default

2 participants