mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-17 08:48:58 +00:00
Expose v8 CpuProfiler + add fast properties for some window properties
First, this exposes the v8 Profiler. Right now it's just a commented-out block in `fetch` and meant for internal debugging. Depends on: https://github.com/lightpanda-io/zig-v8-fork/pull/105 Use postAttach on Window to attach "static" properties. This comes from profiling (lightpanda.io) and seeing window.get_self called tens of thousands of times.
This commit is contained in:
18
src/main.zig
18
src/main.zig
@@ -165,6 +165,24 @@ fn run(alloc: Allocator) !void {
|
||||
// page
|
||||
const page = try session.createPage();
|
||||
|
||||
// // Comment this out to get a profile of the JS code in v8/profile.json.
|
||||
// // You can open this in Chrome's profiler.
|
||||
// // I've seen it generate invalid JSON, but I'm not sure why. It only
|
||||
// // happens rarely, and I manually fix the file.
|
||||
// page.js.startCpuProfiler();
|
||||
// defer {
|
||||
// if (page.js.stopCpuProfiler()) |profile| {
|
||||
// std.fs.cwd().writeFile(.{
|
||||
// .sub_path = "v8/profile.json",
|
||||
// .data = profile,
|
||||
// }) catch |err| {
|
||||
// log.err(.app, "profile write error", .{ .err = err });
|
||||
// };
|
||||
// } else |err| {
|
||||
// log.err(.app, "profile error", .{ .err = err });
|
||||
// }
|
||||
// }
|
||||
|
||||
_ = page.navigate(url, .{}) catch |err| switch (err) {
|
||||
error.UnsupportedUriScheme, error.UriMissingHost => {
|
||||
log.fatal(.app, "invalid fetch URL", .{ .err = err, .url = url });
|
||||
|
||||
Reference in New Issue
Block a user