GC thrashing causing input latency in 1.4.z

Describe the Bug

Performance degradation due to frequent GC pauses. It looks like storeGeneratedContent is an O(n^2) operation which causes a ton of allocations during editing and makes GC pauses more frequent. Since these pauses are more likely to happen around input events the effect is quite noticable

Possibly related to Cursor 1.3.х started freezing randomly , Cursor very laggy

Steps to Reproduce

It’s hard to say there’s definite steps to reproduce it, but just by looking at the code I think any case where you have a lot of AI changes across many lines in a workspace it’ll eventually take more memory every time you accept (or diff!)

Operating System

Linux

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.4.3
VSCode Version: 1.99.3
Commit: e50823e9ded15fddfd743c7122b4724130c25df0
Date: 2025-08-08T17:34:53.060Z
Electron: 34.5.1
Chromium: 132.0.6834.210
Node.js: 20.19.0
V8: 13.2.152.41-electron.0
OS: Linux x64 6.15.9-201.fc42.x86_64

Additional Information

I rebuilt the AppImage and changed

for (const o of r)
    this.generatedContentHashes.set(o.hash, o.metadata),
    this.saveStoredHashes();

to

for (const o of r)
    this.generatedContentHashes.set(o.hash, o.metadata);
this.saveStoredHashes();

This single character change ended up saving about a megabyte of allocations per loop in my case and made Minor GC Pause go from ~5-8% of runtime down to ~1% on the main thread.

I’m sure with the actual source code you could do even more to optimize the allocations surrounding this loop but this change seems like a good win on its own.

Does this stop you from using Cursor

No - Cursor works, but with this issue

1 Like

Thank you for flagging this!

Please try Cursor Settings > Beta > Update Access: Early Access

Unfortunately I’m locked to stable as an enterprise user but I appreciate that y’all are aware!

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.