integrated-application-development / delphilint

Delphi IDE package providing on-the-fly code analysis and linting, powered by SonarDelphi
GNU Lesser General Public License v3.0
79 stars 9 forks source link

Fix high CPU usage when waiting for server to start #21

Closed fourls closed 4 months ago

fourls commented 4 months ago

The DelphiLint client spawns the server process lazily, but the server communication thread is started on startup. At present, the thread spin-waits until the process is started, causing unnecessary CPU usage before an analysis is run for the first time (idle CPU usage up to 8-10% on my PC).

This PR modifies the thread logic to instead wait for a TEvent that is triggered when the server process is initialized. This fixes the issue (idle CPU usage back down to 0-0.5% on my PC).

Fixes #20.