Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce memory footprint of rich text values #14897

Closed
wants to merge 3 commits into from

Conversation

ellatrix
Copy link
Member

Description

[Still needs unit tests.]

This change ensures that format arrays are reused for multiple characters in a row. We already reuse the format objects themselves, but not the array containing them, if the contents are the same.

Before:

1234 (references)
↑↑↑↑
  BB
AAAA
test
1122 (references)
↑↑↑↑
  BB
AAAA
test

It also makes normaliseFormats faster for already normalised values, because it can now use the array reference to check equality.

How has this been tested?

Screenshots

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@ellatrix ellatrix added [Type] Performance Related to performance efforts [Package] Rich text /packages/rich-text labels Apr 10, 2019
@ellatrix
Copy link
Member Author

Has failing e2e tests. Closing for now.

@ellatrix ellatrix closed this Apr 24, 2019
@ellatrix ellatrix deleted the try/rich-text-reuse-format-lists branch April 24, 2019 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Rich text /packages/rich-text [Type] Performance Related to performance efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant