commit d0e98a01052e8b3572b88ed467b484d5a0e94e21
parent 68c4fcf33eb0fcb99bc7041a059fd1c7270d85ea
Author: Nixon Enraght-Moony <nixon.emoony@gmail.com>
Date: Mon, 25 Apr 2022 12:38:11 +0100
time::chrono: Buffer read_leapsecfile
Reduces the number of syscalls in `./.bin/hare` from 10704 to 41.
Even if this won't have much of a performace imporvement, it makes
`strace` debugging much nicer.
Signed-off-by: Nixon Enraght-Moony <nixon.emoony@gmail.com>
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/time/chrono/leapsec.ha b/time/chrono/leapsec.ha
@@ -45,8 +45,10 @@ let utc_leapsecs: [](i64, i64) = [];
};
fn read_leapsecfile(h: io::handle, leapsecs: *[](i64, i64)) (void | io::error) = {
+ let buffer: [os::BUFSIZ]u8 = [0...];
+ const b = bufio::buffered(h, buffer, []);
for (true) {
- const line = match (bufio::scanline(h)) {
+ const line = match (bufio::scanline(&b)) {
case let err: io::error =>
return err;
case io::EOF =>