this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

cell: use non-branching return for equality

This reduces the time in Vaxis.render. I ran perf several times for ~60
seconds each time on example/vaxis.zig.

Before => 15.17% in Vaxis.render
After => 14.15% in Vaxis.render

+9 -8
comlink.perf

This is a binary file and will not be displayed.

comlink.perf.old

This is a binary file and will not be displayed.

+3
examples/vaxis.zig
··· 79 79 }; 80 80 const center = vaxis.widgets.alignment.center(win, 28, 4); 81 81 _ = center.printSegment(segment, .{ .wrap = .grapheme }); 82 + // var bw = tty.bufferedWriter(); 83 + // try vx.render(bw.writer().any()); 84 + // try bw.flush(); 82 85 try vx.render(tty.anyWriter()); 83 86 std.time.sleep(16 * std.time.ns_per_ms); 84 87 switch (dir) {
+6 -8
src/InternalScreen.zig
··· 19 19 default: bool = true, 20 20 21 21 pub fn eql(self: InternalCell, cell: Cell) bool { 22 + 22 23 // fastpath when both cells are default 23 24 if (self.default and cell.default) return true; 24 - // this is actually faster than std.meta.eql on the individual items. 25 - // Our strings are always small, usually less than 4 bytes so the simd 26 - // usage in std.mem.eql has too much overhead vs looping the bytes 27 - if (!std.mem.eql(u8, self.char.items, cell.char.grapheme)) return false; 28 - if (!Style.eql(self.style, cell.style)) return false; 29 - if (!std.mem.eql(u8, self.uri.items, cell.link.uri)) return false; 30 - if (!std.mem.eql(u8, self.uri_id.items, cell.link.params)) return false; 31 - return true; 25 + 26 + return std.mem.eql(u8, self.char.items, cell.char.grapheme) and 27 + Style.eql(self.style, cell.style) and 28 + std.mem.eql(u8, self.uri.items, cell.link.uri) and 29 + std.mem.eql(u8, self.uri_id.items, cell.link.params); 32 30 } 33 31 }; 34 32