Hi all! I’ve got a function that is suprisingly slow. 80% of my program’s execution is spent in this function:
https://codeberg.org/denis_defreyne/tomatenmark_zig/src/commit/c16b4f83120c22949240c712afa97a8ce4ede612/src/root.zig#L816-L850
See the screenshot for a performance profile. readByte is slow despite reading from a buffered reader. It seems like the buffered reader itself is rather slow? I’m not sure how to optimize this. Thoughts?
Semi-related: This is part of a pull parser, which would make async I/O rather useful here. Reading the file and parsing can happen in parallel. Is it worth looking into async IO or wait until Zig 0.15 with the async IO changes?