diff options
author | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2022-09-01 00:14:37 +0000 |
---|---|---|
committer | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2022-09-01 00:14:37 +0000 |
commit | 31ac4978244bccd9ce9f48b93b91d0edc670e950 (patch) | |
tree | bf37d61badd0da24f50c79439b5b9d0463253f74 /include/netdb.h | |
parent | da85fc910df590ea0754f6d8fd13aba6b175fc2f (diff) |
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@
Diffstat (limited to 'include/netdb.h')
0 files changed, 0 insertions, 0 deletions