Repository navigation
perf(charts): code-unit ISO date scan in ChartData.parseTime (#1514) - #1604
Merged
Merged
Conversation
parseTime ran a regex, replaceFirst and up to seven substring + int.parse calls per cell, for every cell of a candidate X column (up to 100,000 rows) when the Charts tab opens. The shape check is a small scanner over code units and the date / time fields are read back with _digitsValue; DateTime.tryParse still decides validity and takes the text as is (it accepts a space separator). A test compares the result with the previous implementation on listed and random strings. Closes #1514
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
`ChartData.parseTime` is called for every cell of a candidate X column (up to 100,000 rows) when the Charts tab opens. Per cell it ran a regex, `replaceFirst(' ', 'T')` and up to seven `substring` + `int.parse` calls.
Results are meant to be identical; the tests compare with the previous implementation.
Tests (not run locally; CI will)
`test/features/results/charts/chart_data_parse_time_test.dart` holds the old implementation as the reference and checks about 40 listed values (partial times, fractions, zones, a zone without a time, impossible dates, wrong separators, full-width digits), 6000 seeded random variations of a date string, and a 100,000-row column.
The "under 10 ms on 100,000 rows" acceptance item is not benchmarked here; the test only checks that the pass completes and gives the right answer.
Closes #1514