Skip to content

perf(grid): allocation-light selection export (#1524) - #1616

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/1524-clipboard-export
Oct 15, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
issue/1524-clipboard-export

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Summary

  • toCsv / toTsv created a List<String> per row and joined it. Cells are now written straight into the StringBuffer, with the delimiter before every column except the first. The final trimRight() stays, so the output is byte for byte the previous one (including the quirk that trailing empty cells of the last TSV row are trimmed).
  • toJson compiled RegExp(r'^0\d+$') for every cell. It is _hasLeadingZeroDigits now (a 0 followed by one or more ASCII digits, on the trimmed text), and int.tryParse / double.tryParse results are used directly instead of parsing twice.

Not done: the per-row Map in toJson. JsonEncoder needs the maps, and hand-writing JSON for the clipboard is a larger change than this issue's regex and list costs.

Tests (not run locally; CI will)

test/features/workspace/grid_selection_export_test.dart: CSV and TSV with and without header, quoting of commas / quotes, a column sub-range with an out-of-range column and row, the TSV trailing-cell trim, empty input, and JSON for leading zeros, padded zeros, 0, 0.5, NULL, booleans, plus a multi-row array. Existing context-menu tests are untouched.

Closes #1524

… cell

toCsv and toTsv built a List<String> per row and joined it; toJson compiled
RegExp(r'^0\d+$') for every cell and parsed each number twice.

Cells are written straight into the StringBuffer with a delimiter before every
column but the first. The leading-zero check is a code unit loop, and ints and
doubles are parsed once. Output is unchanged, including the trimRight of the
whole text.

Closes #1524
@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 1609b7f 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