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

Bug: edge case slow highlighting performance #46

Open
thenbe opened this issue Nov 29, 2023 · 0 comments
Open

Bug: edge case slow highlighting performance #46

thenbe opened this issue Nov 29, 2023 · 0 comments

Comments

@thenbe
Copy link

thenbe commented Nov 29, 2023

The following two files are exactly the same except for a single character. Despite that, opening good.nix is 6+ times faster than opening repro.nix.

$ hyperfine -N --ignore-failure "nvim good.nix -c exit" "nvim repro.nix -c exit"
Benchmark 1: nvim good.nix -c exit
  Time (mean ± σ):     174.9 ms ±   5.4 ms    [User: 138.0 ms, System: 44.0 ms]
  Range (min … max):   167.8 ms … 185.5 ms    16 runs

Benchmark 2: nvim repro.nix -c exit
  Time (mean ± σ):      1.192 s ±  0.110 s    [User: 0.506 s, System: 0.687 s]
  Range (min … max):    1.006 s …  1.321 s    10 runs

Summary
  nvim good.nix -c exit ran
    6.81 ± 0.66 times faster than nvim repro.nix -c exit

Minimal repro

  1. Create file good.nix:

    myFunc {
      preCheck = "hello";
      disabledTests = [
        # Lllllll aaaaaaa aaaa aaa `bar`
        ""
      ];
    }
    
  2. Create file repro.nix (identical to first file except for one character)

    myFunc {
      preCheck = "hello";
      disabledTests = [
        # Lllllll aaaaaaa aaaa aaa `bar`
        "f"
      ];
    }
    
  3. Observe that opening repro.nix is very slow, especially when compared to opening good.nix

Version

NVIM v0.10.0-dev-3a34743
Build type: Release
LuaJIT 2.1.1693350652

nvim-treesitter: bf982eb

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