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

Performance with longer documents #14

Open
danielearwicker opened this issue Nov 7, 2013 · 1 comment
Open

Performance with longer documents #14

danielearwicker opened this issue Nov 7, 2013 · 1 comment
Assignees

Comments

@danielearwicker
Copy link
Owner

In Chrome typing becomes progressively slower as the document gets longer.

Some obvious improvements:

  • The canvas is sized large enough for the whole document, which is unnecessary. We only need to create a canvas large enough for the visible viewport of the scrollable area, and so we can search for the first line that needs drawing and stop after the last one. On scroll events, we'd move the canvas to appear in the right place and repaint it.
  • The wrapping could also be optimised so it stops at the next newline and merely adjusts the y positions of the existing lines below.
@ghost ghost assigned danielearwicker Nov 7, 2013
@danielearwicker
Copy link
Owner Author

Partially implemented - the canvas now is viewport-sized and moves to stay in view as the user scrolls. This alone means that in Chrome you can have a 70,000+ word document (virtual document height of 100,000+ pixels) and scrolling and text selection is still instantaneous. For comparison, a thesis might be 60,000 words, a novel 100,000.

Typing is pretty slow because of the unnecessary wrapping of the whole document on every insert, hence leaving this issue open to implement the second part at some point.

danielearwicker added a commit that referenced this issue Nov 7, 2013
… can now scroll and do text-selection very fast with long documents (70,000+ words)
dhrleandro pushed a commit to dhrleandro/carota that referenced this issue Feb 23, 2024
 BR tag should close itself to avoid browser standard issues
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

No branches or pull requests

1 participant