elbywan / crystalline

A Language Server Protocol implementation for Crystal. 🔮
MIT License
424 stars 21 forks source link

High CPU usage #6

Closed antondalgren closed 3 years ago

antondalgren commented 3 years ago

I'm running crystalline within a fairly large project. The CPU usage is pending between 20% and 60% with the codebase completely idle. Upon a save it can reach more than 200% (Using top on OSX to read these values)

elbywan commented 3 years ago

Hi @antondalgren,

Upon a save it can reach more than 200% (Using top on OSX to read these values)

Yes, Crystalline (and by extension the crystal compiler that is used under the hood) is CPU intensive which could only be changed if someone takes time to add incremental semantic analysis. I have an idea about how to do it, but I don't have the bandwidth to work on it unfortunately (and it is pretty intensive work).

The CPU usage is pending between 20% and 60% with the codebase completely idle.

Are you sure that this CPU usage comes from crystalline itself? On my macbook I had to downgrade VSCode from >= 1.50.0 back to 1.49.X because vscode is buggy and has a rendering process that is doing exactly what you describe when the editor is idle.

See: https://github.com/microsoft/vscode/issues/108441

On idle, crystalline is expected to use 0% cpu since it does nothing else than waiting for requests and notifications from the client.

antondalgren commented 3 years ago

I'm running 1.49.3. Since monday this problem stopped occurring.

Most likely not a problem with crystalline!

Thank you for your time and the keep up the good work on this @elbywan!