diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2022-02-05 13:36:53 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2022-02-05 13:42:38 +0100 |
commit | 4599b3b679d538c75fb7de8190fe5fc340beacc2 (patch) | |
tree | 0a36da4364123fec9496bafe0357f5dc0b5ad893 | |
parent | 4e0df8dcb868d12745470794a97f7ab0eda8da8c (diff) |
sfeed: small optimization
For feeds with lots of content data:
Small performance improvement (~2%) on systems that implement putchar as a
macro. On some systems using a function call for putchar it can be easier to
replace with putchar_unlocked.
(On an older MIPS32 VM changing putchar to putchar_unlocked makes writing 5x
faster).
-rw-r--r-- | sfeed.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -321,9 +321,9 @@ string_print_encoded(String *s) for (; *p && p != e; p++) { switch (*p) { - case '\n': fputs("\\n", stdout); break; - case '\\': fputs("\\\\", stdout); break; - case '\t': fputs("\\t", stdout); break; + case '\n': putchar('\\'); putchar('n'); break; + case '\\': putchar('\\'); putchar('\\'); break; + case '\t': putchar('\\'); putchar('t'); break; default: /* ignore control chars */ if (!iscntrl((unsigned char)*p)) |