Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@mdebbar
Copy link
Contributor

@mdebbar mdebbar commented Aug 5, 2020

Description

During the text measurement process, we do multiple lookbacks at each chunk of text to check for trailing spaces and new lines. With this PR, we eagerly track spaces and new lines during the line break detection phase. This ensures we only take one pass at the text and no extra iterations.

The main purpose of this PR was cleanup but it's nice to get some bonus perf improvements as well. In the text_canvas_color_grid benchmark we got the following improvements:

  • Text layout: 9%
  • Draw frame: 3%

Tests

This is a pure refactoring PR, so I'm relying on the existing comprehensive tests in:

  • test/text/line_breaker_test.dart
  • test/text/measurement_test.dart
  • test/paragraph_test.dart

@mdebbar mdebbar added the platform-web Code specifically for the web engine label Aug 5, 2020
@mdebbar mdebbar requested review from ferhatb and yjbanov August 5, 2020 23:04
@mdebbar mdebbar self-assigned this Aug 5, 2020
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes platform-web Code specifically for the web engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants