also looking at this
Migrate to zig 0.16
#5
13 files
+222
-239
Review threads live on the whole diff, not on one commit, so none are shown here - a thread's line means something in the branch's final form, and painting it into an intermediate step would put it on code it is not about.
| @@ -39,6 +39,7 @@ pub fn build(b: *std.Build) void { | ||
| 39 | 39 | // Later on we'll use this module as the root module of a test executable |
| 40 | 40 | // which requires us to specify a target. |
| 41 | 41 | .target = target, |
| 42 | .link_libc = true, | |
| 42 | 43 | }); |
| 43 | 44 | |
| 44 | 45 | // Here we define an executable. An executable needs to have a root module |
| @@ -192,13 +192,13 @@ test "profiler basic operations" { | ||
| 192 | 192 | const io = std.testing.io; |
| 193 | 193 | var profiler = Profiler.init(allocator, io, true); |
| 194 | 194 | |
| 195 | profiler.startCompilation(); | |
| 195 | profiler.startCompilation(io); | |
| 196 | 196 | // Do some work (just loop to consume time) |
| 197 | 197 | var i: usize = 0; |
| 198 | 198 | while (i < 1000) : (i += 1) { |
| 199 | 199 | _ = i * i; |
| 200 | 200 | } |
| 201 | profiler.endCompilation(); | |
| 201 | profiler.endCompilation(io); | |
| 202 | 202 | |
| 203 | 203 | profiler.recordStateCreation(5); |
| 204 | 204 | profiler.recordBacktrack(); |
| @@ -216,8 +216,8 @@ test "scoped timer" { | ||
| 216 | 216 | var profiler = Profiler.init(allocator, io, true); |
| 217 | 217 | |
| 218 | 218 | { |
| 219 | var timer = ScopedTimer.init(&profiler, .match); | |
| 220 | defer timer.deinit(); | |
| 219 | var timer = ScopedTimer.init(&profiler, io, .match); | |
| 220 | defer timer.deinit(io); | |
| 221 | 221 | // Do some work |
| 222 | 222 | var i: usize = 0; |
| 223 | 223 | while (i < 1000) : (i += 1) { |
| @@ -191,7 +191,8 @@ test "RegexCache basic operations" { | ||
| 191 | 191 | |
| 192 | 192 | test "thread-safe allocator with concurrent matching" { |
| 193 | 193 | // Use thread-safe allocator for concurrent access |
| 194 | var gpa = std.heap.GeneralPurposeAllocator(.{ .thread_safe = true }){}; | |
| 194 | var gpa = std.heap.DebugAllocator(.{ .thread_safe = true }){}; | |
| 195 | // TODO: can use this for leak detection | |
| 195 | 196 | defer _ = gpa.deinit(); |
| 196 | 197 | const allocator = gpa.allocator(); |
| 197 | 198 | |
| @@ -222,7 +223,7 @@ test "thread-safe allocator with concurrent matching" { | ||
| 222 | 223 | } |
| 223 | 224 | |
| 224 | 225 | test "concurrent matching different patterns" { |
| 225 | var gpa = std.heap.GeneralPurposeAllocator(.{ .thread_safe = true }){}; | |
| 226 | var gpa = std.heap.DebugAllocator(.{ .thread_safe = true }){}; | |
| 226 | 227 | defer _ = gpa.deinit(); |
| 227 | 228 | const allocator = gpa.allocator(); |
| 228 | 229 | |
| @@ -272,7 +273,7 @@ test "concurrent matching different patterns" { | ||
| 272 | 273 | } |
| 273 | 274 | |
| 274 | 275 | test "stress test: many threads many matches" { |
| 275 | var gpa = std.heap.GeneralPurposeAllocator(.{ .thread_safe = true }){}; | |
| 276 | var gpa = std.heap.DebugAllocator(.{ .thread_safe = true }){}; | |
| 276 | 277 | defer _ = gpa.deinit(); |
| 277 | 278 | const allocator = gpa.allocator(); |
| 278 | 279 | |