Skip to content

Bug: Extremely slow performance in big documents #7422

Description

@hyperknot

Lexical version: 0.29.0

Steps To Reproduce

  1. Create an extremely basic editor. No plugins, no anything, just
    const config = {
      namespace: 'test',
      onError: console.error,
    }

    editor = createEditor(config)
    editor.setRootElement(ref)
  1. Copy a large piece of text to the clipboard in a browser. I just selected all on a big Hacker News comments thread (about 500 kB characters) and copied it.
  2. Paste it into lexical using Cmd + V.
  3. Paste it into lexical using Cmd + Shift + V.

The current behavior

  • Very slow pasting with Cmd + V.
  • Extremely slow pasting - taking minutes(!!) on a M1 Macbook Pro
  • Super slow text editing once the text has been pasted. Almost 1 sec latency for inserting/deleting a character.

This is all in plain text mode. No plugins, no nothing, just a core editor.

The expected behavior

Prosemirror does all of these nearly instantly. Pasting is max 1-2 seconds, latency is fluid even with a big document.

I'm considering migrating to Prosemirror, just because of this performance problem on large documents.

Do you know if this is inherent on the design of lexical, or there is a chance of solving this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement over existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions