mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-10-10 13:22:09 -04:00
telemetry: Move telemetry worker to its own thread
This reverts recent(ish) changes to telemetry which moved it from its own thread onto the main thread. The downside is: we have an extra thread. The upside is largely that Network.zig becomes drastically simpler and more efficient. There's a bunch of machinery in Network.zig to support arbitrary workers, of which Telemetry is the only one. There's also a lot of code to support an optional multi and requests made to is. This is all removed. Also, fetch, agent and mcp without a cdp server no longer even need to start the network loop. And, it IS started (e.g. serve/cdp), there's no longer an arbitrary 250ms wakeup on poll to progress workers. Nor can telemtry block CDP. Telemetry's implementation itself was changed. The ring buffer was removed in favor of a double-buffer arraylist. When telemetry is disabled, this saves 64Kb of memory. When it's enabled, it creates more allocator churn, but should still use less memory in most cases (and never more). Finally, Telemetry is given its own easy connection rather than using one out of the pool (which workers would maybe like to use).
This commit is contained in:
4 files changed
+195
-316
No files matched your search
@@ -668,6 +668,14 @@ pub const Connection = struct {
|
||||
return self.getResponseCode();
|
||||
}
|
||||
|
||||
// Synchronous transfer that adds no request headers. request() injects the
|
||||
// browser User-Agent / sec-ch-ua machinery meant for page fetches; callers
|
||||
// that manage their own connection (telemetry) use this leaner path.
|
||||
pub fn perform(self: *const Connection) !u16 {
|
||||
try libcurl.curl_easy_perform(self._easy);
|
||||
return self.getResponseCode();
|
||||
}
|
||||
|
||||
pub fn wsStartFrame(self: *const Connection, frame_type: libcurl.WsFrameType, size: usize) !void {
|
||||
try libcurl.curl_ws_start_frame(self._easy, frame_type, @intCast(size));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user