-
Notifications
You must be signed in to change notification settings - Fork 237
add pump message loop calls #829
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
src/runtime/js.zig
Outdated
@@ -260,6 +263,24 @@ pub fn Env(comptime State: type, comptime WebApis: type) type { | |||
self.isolate.performMicrotasksCheckpoint(); | |||
} | |||
|
|||
pub fn pumpMessageLoop(self: *const Self) bool { | |||
if (self.platform == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these are potentially called in a tight loop, I think you can do this at comptime:
if (comptime builtin.is_test) {
if (self.platform == null) return false;
}
// assume it's not-null in non-test.
return self.platform.?.inner.pumpMessageLoop(self.isolate, false);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if I should use a different slower loop for these tasks separated from the microtasks one.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what this is doing, so it's hard to say.
The page's messageLoopCallback
is not being called very often. all of page.navigate (including processing all synchronous scripts) are executed before it's ever called. This could change if navigate became fully asynchronous though.
It's only being called often when we're "done" navigating and waiting for
1 - New cdp sessions
2 - I/O (i.e. an XHR request is live)
In both cases, I would think it's mostly a no-op.
Besides the small [optional] optimization tweak above, PR is good. Probably some opportunities to tighten up the test code. There's always a platform, but the fact that you don't have access to it in some parts of the test code is unfortunate. I think it's just that |
c334842
to
001364b
Compare
pump message loop could be relative to v8's garbage collector, but I'm not sure about that. idk for idleTasks... |
eee458e
to
9d1dc97
Compare
depends on lightpanda-io/zig-v8-fork#79