Skip to content

Improve performance by kwarg parsing - #273

Merged
jquast merged 3 commits into
masterfrom
jq/improve-kwargs-performance
Sep 23, 2026
Merged

jquast merged 3 commits into
masterfrom
jq/improve-kwargs-performance

Conversation

@jquast

@jquast jquast commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner

The C extension is ~15% faster where callers pass the default ambiguous_width and term_program corrections. Keyword arguments parsed by number passed, not by their position in the parameter list.

A case found when making C11 coverage, about measurement mismatch for
very-long 64+ byte escape sequences
* **Improved** the C extension is up to 3x faster where callers pass the
  default ``ambiguous_width`` and ``term_program`` corrections. Keyword
  arguments parsed by number passed, not by their position in the
  parameter list.
@codspeed

codspeed Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 15.81%

⚠️ 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

⚡ 25 improved benchmarks
✅ 94 untouched benchmarks
🆕 2 new benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_clip_japanese_to_end 77.7 µs 60.1 µs +29.27%
⚡ test_clip_with_ansi 82 µs 64.8 µs +26.53%
⚡ test_clip_japanese 82.2 µs 65.2 µs +25.98%
⚡ test_clip_complex_sgr 82.7 µs 66.1 µs +25.16%
⚡ test_clip_with_ansi_no_propagate 80 µs 64.6 µs +23.89%
⚡ test_clip_with_ansi_no_overtype 87 µs 71.5 µs +21.57%
⚡ test_clip_complex_sgr_no_overtype 87.3 µs 72.6 µs +20.21%
⚡ test_clip_dense_ansi_past_window 106.2 µs 89.6 µs +18.48%
⚡ test_clip_long_cjk_past_window 125.2 µs 107.9 µs +15.99%
⚡ test_clip_dense_ansi_no_overtype 110 µs 95 µs +15.88%
⚡ test_width_ascii 26.6 µs 23.3 µs +14.35%
⚡ test_clip_emoji_zwj 145.9 µs 128.1 µs +13.86%
⚡ test_wcswidth_short_ascii 25.5 µs 22.5 µs +12.95%
⚡ test_ljust_ascii 29.3 µs 26 µs +12.65%
⚡ test_center_ascii 29.7 µs 26.4 µs +12.23%
⚡ test_rjust_ascii 29.2 µs 26.2 µs +11.49%
⚡ test_wcswidth_short_mixed 27.4 µs 24.6 µs +11.47%
⚡ test_wcswidth_emoji_sequence 29.8 µs 26.8 µs +11.32%
⚡ test_wcstwidth_emoji_term_program[xterm.js] 59.3 µs 53.3 µs +11.12%
⚡ test_strip_sequences_simple 27.5 µs 24.7 µs +11.11%
... ... ... ... ...

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

Tip

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


Comparing jq/improve-kwargs-performance (5673cf8) with master (8cda5e6)

Open in CodSpeed

@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.49%. Comparing base (8cda5e6) to head (5673cf8).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #273   +/-   ##
=======================================
  Coverage   87.49%   87.49%           
=======================================
  Files          41       41           
  Lines        5614     5614           
  Branches     1501     1501           
=======================================
  Hits         4912     4912           
  Misses        324      324           
  Partials      378      378           

☔ 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
jquast force-pushed the jq/improve-kwargs-performance branch from e8271db to 5673cf8 Compare September 23, 2026 18:34
@jquast
jquast marked this pull request as ready for review September 23, 2026 18:39
@jquast
jquast merged commit 8c22e24 into master Sep 23, 2026
36 checks passed
@jquast
jquast deleted the jq/improve-kwargs-performance branch September 23, 2026 18:41
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