Skip to content

Performance issues with long lines and brace matching #1242

@joelrbrandt

Description

@joelrbrandt

For long lines (e.g. data URIs), CodeMirror turns off syntax highlighting to be more performant. However, other features (like brace matching) are not turned off. This can cause performance issues.

Steps to reproduce:

  1. Create an editor with brace matching enabled
  2. Open a file like https://github.com/adobe/brackets-edge-web-fonts/blob/master/styles/adobe-blank.css
  3. Place the cursor at the very end of a long line
  4. Use the back arrow to back the cursor up to the closing parenthesis

Expected behavior:

Fast, fast, fast

Actual behavior:

Slow, slow, slow

There are probably other performance issues with long lines (and long files). This is just one example.

I don't think we can ever expect that every feature we implement will be performant on large files. Instead, I wonder if the right solution might be something like:

  • Have heuristics around when things might be slow (e.g. file and line length)
  • Produce a warning / error when such heuristics are met, and turn the editor into a basic text editor
  • Give the user a way to override the "turning into a basic text editor" behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions