Skip to content

Relatively high cpu utilization when idle #329

@rwols

Description

@rwols

Describe the bug
This server uses about 10% of my CPU when doing nothing.

To Reproduce

  1. Start lua-language-server manually in a terminal. Something like this: ./bin/macOS/lua-language-server -E -e LANG=\"EN-us\" main.lua
  2. Watch CPU utilization float around 10% in an activity manager.

Expected behavior
0% CPU utilization when idle.

Screenshots
image

Environment (please complete the following information):

  • OS: macOS 11.1

Additional context

I'm guessing this is due to a timer busy-looping in script/service/service.lua:

function m.startTimer()
    while true do
        ::CONTINUE::
        pub.step()
        if await.step() then
            goto CONTINUE
        end
        thread.sleep(0.001)
        timer.update()
    end
end

But it's only speculation at this point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions