Improve performance by kwarg parsing - #273
Conversation
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.
Merging this PR will improve performance by 15.81%
|
| 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)
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
e8271db to
5673cf8
Compare
The C extension is ~15% faster where callers pass the default
ambiguous_widthandterm_programcorrections. Keyword arguments parsed by number passed, not by their position in the parameter list.