Skip to content

sleep 16ms when using synchronous io on windows for reducing cpu usage#175

Open
bung87 wants to merge 1 commit intoPMunch:masterfrom
bung87:sleep
Open

sleep 16ms when using synchronous io on windows for reducing cpu usage#175
bung87 wants to merge 1 commit intoPMunch:masterfrom
bung87:sleep

Conversation

@bung87
Copy link
Contributor

@bung87 bung87 commented Jan 6, 2024

No description provided.

@PMunch
Copy link
Owner

PMunch commented Jan 11, 2024

Why would we need to sleep with synchronous IO? It should just block on the read of stdin. And why 16ms?

@bung87
Copy link
Contributor Author

bung87 commented Jan 11, 2024

it's 1000ms / 60fps, the infinite loop cause cpu high, but it doesn't has to be. as the server is for text editor not game nor real time application, I think it's fine.

@PMunch
Copy link
Owner

PMunch commented Jan 11, 2024

Ah right, I guess 16ms makes sense. But it still doesn't make sense that it busy loops in an infinite loop. Since its using synchronous IO it should be blocking on trying to read input from standard input. If you're seeing high CPU usage with nimlsp it's much more likely a nimsuggest issue.

@bung87
Copy link
Contributor Author

bung87 commented Jan 12, 2024

yeah, the result is it get lower cpu usage on some projects, some still very high.

@PMunch
Copy link
Owner

PMunch commented Jan 12, 2024

Again, it doesn't make any sense that sleeping before a synchronous read should affect CPU performance short of just limiting the amount of actual work it's able to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants