Sitemap

How to Enhance the Performance of Cursor

2 min readApr 28, 2025

Working with modern JavaScript/TypeScript projects often means dealing with a massive node_modules directory. While Cursor’s code-search and AI-assisted features are powerful, scanning tens of thousands of files every time can introduce latency. In this post, we’ll look at how to dramatically improve Cursor’s performance by leveraging ignore files and Git’s exclude mechanism to skip unnecessary directories like node_modules.

Why Performance Matters

  • Instant feedback
    Cursor aims to provide near-instant code completions, in-context examples, and semantic search. When Cursor crawls your entire repo — especially huge dependency folders — its responsiveness suffers.
  • Resource usage
    Frequent full-repo scans consume CPU, memory, and I/O, slowing not just Cursor but your entire machine.

By telling Cursor exactly what to skip, you free up resources for the files that matter: your source code.

Step 1: Create a .cursorignore File

Some versions of Cursor respect a dedicated ignore file (similar to .gitignore). At the root of your project:

touch .cursorignore

Then add patterns:

# .cursorignore
node_modules/
dist/
.vscode/
*.log

This tells Cursor to skip anything under node_modules/, your build dist/ folder, editor settings, and logs.

Step 2: Configure Git’s Local Exclude

Git maintains a private exclude file at .git/info/exclude. Unlike .gitignore, this file is never committed and applies only to your local clone.

1.Open the exclude file

code .git/info/exclude

2.Add your ignore patterns

# .git/info/exclude
node_modules/
dist/

3.Save and close.

Cursor tools that are Git-aware will now automatically ignore these paths without requiring a shared .gitignore.

Step 3: Next Up — Measure the Impact

At the time of writing, the performance measurements are still pending. Your next action is to quantify exactly how much time Cursor saves by skipping node_modules/:

1.Benchmark indexing times before and after adding your ignore rules:

time cursor .

2.Compare the results:

  • Check that all code completions and search hits remain consistent.
  • Record the reduction in indexing time (e.g., from 45 s down to 5 s).

Once you’ve gathered these numbers, you’ll have concrete proof of the speedup — and peace of mind that no functionality was lost.

Best Practices & Tips

  • Global Git excludes
    For a permanent, cross-project solution, set up a global Git excludes file:
git config --global core.excludesFile '~/.gitignore_global'

Then add node_modules/, dist/, etc., to ~/.gitignore_global.

  • Keep your ignores DRY
    If you use both .gitignore and .cursorignore, try to maintain them in sync or automatically generate one from the other to avoid divergence.
  • Review periodically
    As your project evolves, new build folders or generated content may appear — update your ignore patterns accordingly.

Conclusion

By combining a dedicated .cursorignore file with Git’s local exclude mechanism—and by measuring the performance gains—you can ensure Cursor stays blazing fast on even the largest codebases. Next step: run those benchmarks and share your results! Happy coding!

--

--

Tomoharu Tsutsumi
Tomoharu Tsutsumi

Written by Tomoharu Tsutsumi

Senior SWE (Ruby, Go, TypeScript, JavaScript) in Vancouver

Responses (1)