Repository navigation
perf(grid): allocation-light selection export (#1524) - #1616
Merged
Merged
Conversation
… 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
toCsv/toTsvcreated aList<String>per row andjoined it. Cells are now written straight into theStringBuffer, with the delimiter before every column except the first. The finaltrimRight()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).toJsoncompiledRegExp(r'^0\d+$')for every cell. It is_hasLeadingZeroDigitsnow (a0followed by one or more ASCII digits, on the trimmed text), andint.tryParse/double.tryParseresults are used directly instead of parsing twice.Not done: the per-row
MapintoJson.JsonEncoderneeds 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