Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

[performance]: Low frame rate when the matching bracket spans several hundreds of lines #348

@robertrossmann

Description

@robertrossmann

Prerequisites

Description

When trying to type in front of a bracket and the corresponding closing bracket is located several hundreds of lines later, the editor's frame rate drops significantly and typed characters appear almost half a second later.

Example code:

describe('test', () => {
//      ^ start typing here with cursor in front of the opening (
// ... lots and lots of JS here (1200 SLOC)
})

Steps to Reproduce

  1. Open a huge file (tested on JavaScript file with big test suite)
  2. Place the cursor in front of the opening bracket while the matching closing bracket is located several hundreds of lines later
  3. Attempt to type some characters
  4. Observe editor lag

Expected behavior: No editor lag, smooth typing experience, feelings of joy and happiness

Actual behavior: typed characters appear after several hundreds of ms, editor feels unresponsive, feelings of anger and frustration

Reproduces how often: 100% of the time, but only when the matching bracket is very very far away

Versions

Atom    : 1.26.0-beta1
Electron: 1.7.11
Chrome  : 58.0.3029.110
Node    : 7.9.0
OS: MacOS 10.13.4

Additional Information

I am attaching Chrome's performance profile for further inspection. From the stack traces included there I concluded that this is likely a problem with the bracket-matcher package. Disabling the package resolves the issue described here.

I have not looked at the code at all, but it almost seems that bracket-matcher is searching for the matching bracket on each keystroke even though none of the brackets are actually modified, only the content in front of them. 🤔

bracket-matcher.json.zip

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