CVSROOT: /cvs Module name: src Changes by: chel...@cvs.openbsd.org 2022/08/31 18:14:36
Modified files: usr.bin/ts : ts.c Log message: ts(1): parse user format string only once Currently, ts(1) reparses the user format string every time it prints a timestamp. This is wasteful. If we isolate the parsing loop in fmtfmt() and move the rest of the work into a new function, fmtprint(), we can cut some overhead out of the hot loop. We still need to update any microsecond substrings in the parsed format string every time we print a timestamp. So during parsing in fmtfmt() we build a list of pointers to locations in the parsed buffer where the microsecond substring needs to be copied during fmtprint(). With input from deraadt@. Link1: https://marc.info/?l=openbsd-tech&m=165769139318084&w=2 Link2: https://marc.info/?l=openbsd-tech&m=165910022501353&w=2 OK job@