weblink icon indicating copy to clipboard operation
weblink copied to clipboard

Change server update loop from NoWait to Default

Open inert-aesthetic opened this issue 1 year ago • 2 comments

Change reduces idle CPU usage by a large amount. (100% to 0%)

Needs testing.

I have confirmed only that POST and GET requests with plain text still work.

inert-aesthetic avatar Sep 26 '24 20:09 inert-aesthetic

One issue is that LoopRunMode.Default prevents users from returning from the listen method (param blocking:Bool):

function main() {
	new weblink.Weblink().listen(2000, false);
	trace("hello!"); // isn't called with this patch
}

Also, because MainLoop/Thread.events are not integrated with the libuv loop, I do not expect any timers will be ran either.

Frixuu avatar Sep 26 '24 21:09 Frixuu

One issue is that LoopRunMode.Default prevents users from returning from the listen method (param blocking:Bool):

function main() {
	new weblink.Weblink().listen(2000, false);
	trace("hello!"); // isn't called with this patch
}

Also, because MainLoop/Thread.events are not integrated with the libuv loop, I do not expect any timers will be ran either.

Maybe we could build out a system to run the timers using a background thread for the Haxe std. I know for example Heaps.io has to handle the haxe.Timer system as well as openFL instead of the std, where as targets such as JS work out of the box.

PXshadow avatar Sep 27 '24 00:09 PXshadow