Repository navigation
perf(results): decide column kinds from formatted samples, type-test the rest (#1548) - #1665
Merged
Merged
Conversation
…the rest (#1548) CompactResultDataset.fromRawRows formatted every non-null cell with the driver's cell formatter (and stringified it again) only to decide whether a column is int, float, string or generic, and a uniform column never left that loop early. The formatters print a column's ints, numbers and strings by the column's type (bytea, binary, boolean...), not by the value, so the first 60 non-null cells of a column now go through the formatter and the rest are type-tested; the loop also stops as soon as the column can only be generic. Standalone Dart AOT copy of the detection loop, 6 int + 4 double + 10 string columns: 50,000 rows 46 ms -> 20 ms; 5,000 rows (the default cap) 3.5 ms -> 0.5 ms per query run. Same kinds, including a column broken by a late value of another type and a bytea-typed string column.
3 tasks
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.
Closes #1548.
Before (measured)
CompactResultDataset.fromRawRowsdecides each column's kind (int64 / float64 / string / generic). With a cell formatter (every SQL driver passes one), it called the formatter andtoString()again on every non-null cell of every column that stayed uniform. A normal table, where most columns are uniform, therefore formatted every cell once just to pick the kind.The detection loop copied as is into a standalone Dart AOT script, PostgreSQL-like formatter (
ischain +toString), 6 int + 4 double + 10 string columns:Change
is int/is num/is String).tinyint(1)booleans;So the samples show whether the column prints as its values do. A type that is not uniform is still caught on every row by the type test.
Packing (the other ~39 ms of the 50k case in the issue) is unchanged.
Checked
Same kinds from the old and the new loop on the 50,000-row table plus:
Tests (
compact_result_dataset_test.dart)Not run with
flutter testlocally; CI decides.