Visitar URL original
perf: use c allocator for shared io (#92) · ChainSafe/zapi@a736d8a · GitHub
Skip to content

Commit a736d8a

Browse files
authored
perf: use c allocator for shared io (#92)
## Motivation The shared `std.Io.Threaded` uses its allocator for temporary task and future allocations. Using `page_allocator` sends those allocations directly through page mappings instead of allowing ordinary heap reuse. ## Description Use `std.heap.c_allocator` for shared I/O, matching the DSL's existing general-purpose allocator. The zapi module already links libc. This is an allocator-choice optimization; no performance improvement has been benchmarked. Verified with 45 Zig tests, the example addon build, and 136 JS DSL/addon-isolation tests. Changed-file formatting passes; whole-source formatting reports an existing issue in `src/create_callback.zig`, also reproduced at the base revision. AI assistance: Codex prepared this change and ran the checks.
1 parent b56bf2d commit a736d8a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/js/io.zig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const std = @import("std");
22
const lifecycle = @import("lifecycle.zig");
33

4-
const gpa: std.mem.Allocator = std.heap.page_allocator;
4+
const gpa: std.mem.Allocator = std.heap.c_allocator;
55

66
const hooks = struct {
77
fn init(instance: *std.Io.Threaded, prev_refcount: u32) !void {

0 commit comments

Comments
 (0)