diff --git a/bench/twitter/main.zig b/bench/twitter/main.zig index 609967b..2faebec 100644 --- a/bench/twitter/main.zig +++ b/bench/twitter/main.zig @@ -1,7 +1,8 @@ const std = @import("std"); + const dom = @import("simdjzon").dom; -pub const read_buf_cap = std.mem.page_size; +pub const read_buf_cap = 4096; pub fn main() !u8 { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); @@ -21,8 +22,8 @@ pub fn main() !u8 { const array = try statuses.get_array(); var i: usize = 0; while (array.at(i)) |status| : (i += 1) { - _ = status; // autofix - // const id = try status.at_pointer("/id"); + const id = try status.at_pointer("/id"); + std.mem.doNotOptimizeAway(id); // std.debug.print("{}\n", .{try id.get_int64()}); } // std.debug.print("i={}\n", .{i}); diff --git a/src/ondemand.zig b/src/ondemand.zig index b5b5ef9..ed3d3fb 100644 --- a/src/ondemand.zig +++ b/src/ondemand.zig @@ -15,18 +15,18 @@ const CharUtils = string_parsing.CharUtils; /// Users must specify `pub const read_buf_cap = N;` in their root source file. /// This sets the static `ondemand.Parser.read_buf` size. `read_buf` is -/// where chunks of json source are stored. recommended `std.mem.page_size`. +/// where chunks of json source are stored. recommended `std.heap.pageSize()`. /// Larger `read_buf_cap` may improve performance for large json files. pub const READ_BUF_CAP = if (@hasDecl(root, "read_buf_cap")) root.read_buf_cap else if (builtin.is_test) - mem.page_size + 4096 else @compileError( \\root source file is missing a `pub const read_buf_cap` declaration. \\This sets the static `ondemand.Parser.read_buf` size. `read_buf` is \\where chunks of json source are stored. recommended - \\`std.mem.page_size`. + \\`std.heap.pageSize()`. \\ ); diff --git a/src/tests.zig b/src/tests.zig index d517c2a..29f2766 100644 --- a/src/tests.zig +++ b/src/tests.zig @@ -1,14 +1,14 @@ const std = @import("std"); const testing = std.testing; const mem = std.mem; +const allr = testing.allocator; -const TapeType = dom.TapeType; const simdjzon = @import("simdjzon"); const dom = simdjzon.dom; const ondemand = simdjzon.ondemand; const cmn = simdjzon.common; +const TapeType = dom.TapeType; -const allr = testing.allocator; test "tape build 1" { std.debug.print("\n", .{}); const f = try std.fs.cwd().openFile("test/test.json", .{});