Skip to content

perf(grid): regex-free formatNum and comma-only copies in selection stats (#1531) - #1614

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/1531-selection-calc
Oct 15, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
issue/1531-selection-calc

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Summary

Not done: the custom allocation-free number parser the #1520 issue proposes. double.tryParse is correctly rounded and a hand-written parser has to match it digit for digit, which is a bigger risk than the copy it saves, so that issue stays open (Refs).

Tests (not run locally; CI will)

grid_selection_calc_format_test.dart: formatNum on whole, fractional, repeating and round-to-integer values, and compute on a mix of 1,000, padded 2,500.5, NULL, empty, text and duplicate values (counts, distinct, sum, min, max, median).

Closes #1531
Refs #1520

GridSelectionCalcEngine.formatNum compiled two RegExp objects and ran two
replace passes for every stat on every selection change, and compute made a
replaceAll(',', '') copy for every selected cell.

formatNum walks the code units from the end to drop trailing zeros and a
dangling dot. compute strips commas only from cells that contain one. Output
is unchanged.

Closes #1531
Refs #1520
@github-actions github-actions Bot added enhancement New feature or request performance Theme parser epic label: performance core Core library logic and services data-grid Interactive data grid, cell editor, filtering, groupings P2 Medium priority / Parity & Refactoring labels Oct 15, 2026
@github-actions github-actions Bot added this to the 0.5.0 milestone Oct 15, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 864c4a0 into dev Oct 15, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core library logic and services data-grid Interactive data grid, cell editor, filtering, groupings enhancement New feature or request P2 Medium priority / Parity & Refactoring performance Theme parser epic label: performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant