Skip to content

Conversation

@mattsu2020
Copy link
Contributor

  • Add --grouping option to use locale-specific separators in output
  • Add --debug option to print warnings during processing
  • Add libc dependency for locale handling
  • Update help and error messages for new options
  • Add validation to prevent combining grouping with format
  • Include translations for new options in en-US and fr-FR locales

related
tests/numfmt/numfmt.pl

- Add `--grouping` option to use locale-specific separators in output
- Add `--debug` option to print warnings during processing
- Add `libc` dependency for locale handling
- Update help and error messages for new options
- Add validation to prevent combining grouping with format
- Include translations for new options in en-US and fr-FR locales
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/follow-name (fails in this run but passes in the 'main' branch)

@mattsu2020 mattsu2020 marked this pull request as draft January 27, 2026 11:24
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 27, 2026

CodSpeed Performance Report

Merging this PR will degrade performance by 65.65%

Comparing mattsu2020:numfmt.pl (a9b01e9) with main (9cc9ca8)

Summary

❌ 9 regressed benchmarks
✅ 133 untouched benchmarks
⏩ 180 skipped benchmarks1

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

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation numfmt_to_iec[10000] 35.6 ms 103.7 ms -65.65%
Simulation numfmt_round_modes[("up", 10000)] 36 ms 102.6 ms -64.87%
Simulation numfmt_to_si_precision[10000] 37.3 ms 103.8 ms -64.06%
Simulation numfmt_round_modes[("down", 10000)] 36 ms 102.6 ms -64.88%
Simulation numfmt_round_modes[("towards-zero", 10000)] 36.1 ms 103.1 ms -64.99%
Simulation numfmt_from_si[10000] 34.1 ms 95.4 ms -64.29%
Simulation numfmt_large_numbers_si[10000] 38.2 ms 106 ms -63.91%
Simulation numfmt_padding[(10000, 50)] 50 ms 107.3 ms -53.44%
Simulation numfmt_to_si[10000] 35.5 ms 102.2 ms -65.29%

Footnotes

  1. 180 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.

- Conditionally compile locale-related functions for non-Windows platforms
- Add Windows-specific stub implementations for `init_locale`, `locale_decimal_separator_char`, and `locale_grouping_separator_string`
- Mark test helper functions with `#[cfg(test)]` to avoid unused code warnings
- Simplify error handling using `let Some` and `let Ok` patterns
- Replace unsafe C string literal with safer `c""` macro
…rging

- Extracted `format_field_parse_error` function to centralize error message formatting
- Improved `merge_ranges` function with more efficient algorithm using iterator pattern
- Fixed logic bug where grouping validation was checking wrong condition
- Added early return for empty ranges in merge_ranges for better performance
- Simplified error handling in parse_field_list by using the new helper function
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/shuf/shuf-reservoir (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/sort/sort-stale-thread-mem (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/follow-name (fails in this run but passes in the 'main' branch)

@sylvestre
Copy link
Contributor

Once again, please split your pr into several small PR ...

@mattsu2020 mattsu2020 changed the title feat(numfmt): add grouping and debug options with locale support numfmt: add grouping and debug options with locale support Jan 27, 2026
This commit introduces comprehensive support for handling large numbers and decimal precision in the numfmt utility. Key changes include:

- Added num-bigint and num-traits dependencies for arbitrary precision arithmetic
- Implemented DecimalValue struct for precise decimal number representation
- Added new error messages for value overflow scenarios
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/follow-name (fails in this run but passes in the 'main' branch)

…pplied

Added checks for `from_unit` and `to_unit` being 1 to ensure `use_raw` is correctly set when no unit conversion or formatting is applied, fixing potential formatting issues in numfmt.
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/shuf/shuf-reservoir (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/sort/sort-stale-thread-mem (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/numfmt/numfmt is no longer failing!

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.

2 participants