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

Perf: Performance optimization #1964

Merged
merged 4 commits into from
Jul 2, 2024

Conversation

Alspb
Copy link
Collaborator

@Alspb Alspb commented Jul 2, 2024

Description

Performance optimization:

  1. Caches Node.length and Node.offset since these two methods are called very often (partly due to recursion inside) and cause significant lags for large documents. The trickiest thing here is to clear the cache when necessary.
  2. Removes unnecessary Document.from and changes the first argument type in several methods from Delta document to Document document (which is anyway reasonable for a variable named "document").
  3. Change a check including _root.toDelta() to assert.

Related Issues

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I titled the PR using Conventional Commits.
  • I did not modify the CHANGELOG.md nor the package version in pubspec.yaml files.
  • All existing and new tests are passing.
  • I have run the commands in ./scripts/before_push.sh and it all passed successfully

Breaking Change

Does your PR require developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate that with a ! in the title as explained in Conventional Commits).
  • No, this is not a breaking change.

@singerdmx singerdmx merged commit e06aa5b into singerdmx:master Jul 2, 2024
2 checks passed
@Alspb
Copy link
Collaborator Author

Alspb commented Jul 2, 2024

Checked the improvements for example x 50, i.e.
document: Document.fromJson([ for (var i = 0; i < 50; i++) quillTextSample ].expand((x) => x).toList()),
The editor works much faster, so that one can actually work with documents that large (about 70k characters).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[All] Various Performance Issues
3 participants