Skip to content

Commit

Permalink
bench: fix build - add missing 'read_buf_cap'
Browse files Browse the repository at this point in the history
  • Loading branch information
travisstaloch committed Jul 9, 2024
1 parent f2f0a5b commit f547c63
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions bench/twitter/main.zig
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
const std = @import("std");
const dom = @import("simdjzon").dom;

pub const read_buf_cap = std.mem.page_size;

pub fn main() !u8 {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = arena.allocator();
const args = try std.process.argsAlloc(allocator);
if(args.len != 2) {
std.debug.print("USAGE: ./simdjson <file.json>\n", .{});
if (args.len != 2) {
std.debug.print("USAGE: ./simdjson <file.json>\n", .{});
}
var parser = try dom.Parser.initFile(allocator, args[1], .{});
defer parser.deinit();
Expand All @@ -18,16 +20,16 @@ pub fn main() !u8 {
const statuses = try parser.element().at_pointer("/statuses");
const array = try statuses.get_array();
var i: usize = 0;
while(array.at(i)) |status| : (i += 1) {
while (array.at(i)) |status| : (i += 1) {
_ = status; // autofix
// const id = try status.at_pointer("/id");
// std.debug.print("{}\n", .{try id.get_int64()});
// const id = try status.at_pointer("/id");
// std.debug.print("{}\n", .{try id.get_int64()});
}
// std.debug.print("i={}\n", .{i});
if (i != 100) {
std.debug.print("error. expected i=100. found i={}\n", .{i});
return 1;
std.debug.print("error. expected i=100. found i={}\n", .{i});
return 1;
}

return 0;
}
}

0 comments on commit f547c63

Please sign in to comment.