sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit 4599b3b679d538c75fb7de8190fe5fc340beacc2
parent 4e0df8dcb868d12745470794a97f7ab0eda8da8c
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat,  5 Feb 2022 13:36:53 +0100

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).

Diffstat:
Msfeed.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sfeed.c b/sfeed.c @@ -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))