-
Notifications
You must be signed in to change notification settings - Fork 275
Made coroutines make more sense, and fixed a bug. #1381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hopefully this change will bring some responsiveness to the LSP plugin and other things. I remember LSP performed better when I first developed it but at some point lite-xl introduced a change that made things less responsive. I guess it was this cursor blink + coroutine sync issue or maybe a placebo effect from my side :), testing the patch and so far so good. |
OK, I think we're good to go. Should call |
testing it with lsp now, and for some reason typing is more lagged... |
Could be that because it's actually returning when you request it now, you may need to adjust your timeouts to back off a bit, as they'll be getting called how much they should be now, instead of a semi-random amount of times. |
Also with this something is causing wheel scrolling major lagging |
We may have to adjust some of the timeouts; if they're used to things happening with events, they could be overly aggressive. |
Leaving this change here for reference which fixes the lag issue mentioned above which was caused by diff --git a/data/core/init.lua b/data/core/init.lua
index 00322121..386f0276 100644
--- a/data/core/init.lua
+++ b/data/core/init.lua
@@ -1396,11 +1396,10 @@ local run_threads = coroutine.wrap(function()
else
core.threads[k] = nil
end
- elseif wait then
+ else
+ wait = wait or 0.0025 -- default to 400 times per second if wait not specified on coroutine.yield()
thread.wake = system.get_time() + wait
minimal_time_to_wake = math.min(minimal_time_to_wake, wait)
- else
- minimal_time_to_wake = 0
end
else
minimal_time_to_wake = math.min(minimal_time_to_wake, thread.wake - system.get_time()) So far testing seems to indicate better lsp responsiveness without any further changes. |
works fine for me |
Weren't there issues with yields of |
It's not an issue, per-se; if you yield 0, you shouldn't wait anything. The only issue is I'm cool with a default wait (and can implement that, if you like), like jgm said, but that technically would be a change, which I'm not sure if that'd be expected. |
OK; so upon review; jgm is correct, there's a slight issue with |
* Made coroutines make more sense, and fixed a bug. * Fixed typo. * Additional checking for off-cycles. * Fixed issue with calling step too much. * If we have no redraw, set next step time for next frame. * Added in `now` variables to reduce calls.
So there were a couple issues here: