rescript-lang / rescript-vscode

Official VSCode plugin for ReScript
MIT License
329 stars 56 forks source link

perf(language-server): memoize possibly heavy IO utils #1001

Closed cometkim closed 3 months ago

cometkim commented 4 months ago

This could fixes the LSP latency issue

I noticed that caused by mainly spawning multiple rescript -v processes on every single requests, but it could be extreamly slow if there is some process monitor (e.g. antivirus) on the environment.

Ideally, we would create a context object with the LSP server lifespan, but I added simple memoization to make fix easier.

cometkim commented 4 months ago

Maybe it fixes #961 too

zth commented 4 months ago

@cometkim great find, thank you! Here's the other part of the story - reducing latency in the analysis binary itself: https://github.com/rescript-lang/rescript-vscode/pull/1000

This is definitely what we need to do. But, I think we need to think another lap on how and where to memoize. I'll spend some time soon to think about where to do this.

zth commented 4 months ago

Testing alternative approach here: https://github.com/rescript-lang/rescript-vscode/pull/1003