PCRE2 library and benchmark compiled with JIT support with -O3
Pattern compiled with PCRE2_UTF
ctregex example compiled with --release-fast
and use .encoding = .utf8
Example file of 525MB, benchmark cosists of iterating through every line and matching the pattern in the line without anchors (aka search) ten times for every pattern and setting, after warming up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOW | |
/// We use this to return multiple fns with different signatures | |
const AppendedSliceGetter = struct { @"fn": anytype }; | |
fn ConstWrappedSlice(comptime Self: type, comptime Elem: type) type { | |
if (!comptime std.meta.trait.is(.Pointer)(Self)) return []const Elem; | |
return if (@typeInfo(Self).Pointer.is_const) []const Elem else []Elem; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rules that will be inlined. | |
let underscore_sep = r => seq(r, repeat( | |
seq(optional("_"), r), | |
)); | |
let bin = /[01]/; | |
let oct = /[0-7]/; | |
let dec = /[0-9]/; | |
let hex = /[0-9a-fA-F]/; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const trait = std.meta.trait; | |
const assert = std.debug.assert; | |
fn NextCase(comptime src_error_set: type, comptime dst_error_set: type) type { | |
const src_errors = @typeInfo(src_error_set).ErrorSet.?; | |
const dst_errors = @typeInfo(dst_error_set).ErrorSet orelse @compileError("Cannot dispatch into anyerror"); | |
if (dst_errors.len == 0) | |
@compileError("Destination set is empty."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
usingnamespace @import("PeerType/PeerType.zig"); | |
const std = @import("std"); | |
fn MixtimeType(comptime description: anytype, comptime Tuple: type) type { | |
const Context = enum { compiletime, runtime }; | |
const StructField = std.builtin.TypeInfo.StructField; | |
const tuple_fields = std.meta.fields(Tuple); | |
var struct_field_data: [tuple_fields.len]StructField = undefined; | |
var extra_error_msg: []const u8 = "Extraneous fields:\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading data... | |
Took 0.72sec | |
Loaded 8656014 lines, 543369275Bi | |
=========================================== | |
Testing pattern "διακοπεί" on 8656014 lines... | |
Pattern found 10 times | |
Took 495ms | |
1096.15MBi/sec | |
Pattern found 10 times | |
Took 499ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error.Unexpected NTSTATUS=0xc00000ba | |
C:\dev\zig\build-release\lib\zig\std\debug.zig:419:53: 0x7ff7871f9e80 in std.debug.writeCurrentStackTraceWindows (build.obj) | |
const n = windows.ntdll.RtlCaptureStackBackTrace(0, addr_buf.len, @ptrCast(**c_void, &addr_buf), null); | |
^ | |
C:\dev\zig\build-release\lib\zig\std\debug.zig:404:45: 0x7ff7871e364a in std.debug.writeCurrentStackTrace (build.obj) | |
return writeCurrentStackTraceWindows(out_stream, debug_info, tty_config, start_addr); | |
^ | |
C:\dev\zig\build-release\lib\zig\std\debug.zig:125:31: 0x7ff7871e246d in std.debug.dumpCurrentStackTrace (build.obj) | |
writeCurrentStackTrace(stderr, debug_info, detectTTYConfig(), start_addr) catch |err| { | |
^ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn ChildRecursive(comptime T: type) type { | |
var V = T; | |
while (std.meta.trait.is(.Array)(V) or std.meta.trait.is(.Pointer)(V)) : (V = std.meta.Child(V)) {} | |
return V; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const GuildJson = struct { | |
id: []const u8, | |
name: []const u8, | |
icon: []const u8, | |
owner: bool, | |
permissions: u53, | |
features: [][]const u8, | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
usingnamespace @import("std").builtin; | |
pub const endian = Endian.Little; | |
pub const output_mode = OutputMode.Obj; | |
pub const link_mode = LinkMode.Static; | |
pub const is_test = false; | |
pub const single_threaded = false; | |
/// Deprecated: use `std.Target.cpu.arch` | |
pub const arch = Arch.x86_64; | |
pub const abi = Abi.gnu; |
NewerOlder