| ... | @@ -6,18 +6,23 @@ pub fn main() !void { | ... | @@ -6,18 +6,23 @@ pub fn main() !void { |
| 6 | | 6 | |
| 7 | const args = try std.process.argsAlloc(std.heap.page_allocator); | 7 | const args = try std.process.argsAlloc(std.heap.page_allocator); |
| 8 | | 8 | |
| | 9 | // Warm up runs |
| | 10 | var buffer0: [32767]u16 align(4096) = undefined; |
| | 11 | _ = try std.unicode.utf8ToUtf16Le(&buffer0, args[1]); |
| | 12 | _ = try std.unicode.utf8ToUtf16Le_better(&buffer0, args[1]); |
| | 13 | |
| 9 | @fence(.SeqCst); | 14 | @fence(.SeqCst); |
| 10 | var timer = try std.time.Timer.start(); | 15 | var timer = try std.time.Timer.start(); |
| 11 | @fence(.SeqCst); | 16 | @fence(.SeqCst); |
| 12 | | 17 | |
| 13 | var buffer1: [32767]u16 = undefined; | 18 | var buffer1: [32767]u16 align(4096) = undefined; |
| 14 | _ = try std.unicode.utf8ToUtf16Le(&buffer1, args[1]); | 19 | _ = try std.unicode.utf8ToUtf16Le(&buffer1, args[1]); |
| 15 | | 20 | |
| 16 | @fence(.SeqCst); | 21 | @fence(.SeqCst); |
| 17 | const elapsed_ns_orig = timer.lap(); | 22 | const elapsed_ns_orig = timer.lap(); |
| 18 | @fence(.SeqCst); | 23 | @fence(.SeqCst); |
| 19 | | 24 | |
| 20 | var buffer2: [32767]u16 = undefined; | 25 | var buffer2: [32767] u16 align(4096) = undefined; |
| 21 | _ = try std.unicode.utf8ToUtf16Le_better(&buffer2, args[1]); | 26 | _ = try std.unicode.utf8ToUtf16Le_better(&buffer2, args[1]); |
| 22 | | 27 | |
| 23 | @fence(.SeqCst); | 28 | @fence(.SeqCst); |