diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2020-03-09 19:16:52 +0100 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2020-03-10 23:40:17 +0100 |
commit | 991008dc460854b5f2f978a87946f9d90e3e5ee5 (patch) | |
tree | 45a2295bb25d5f13834f924523b127180db81cf4 /README | |
parent | e3461920b100b12eaaca9664ce161519966b58a9 (diff) |
sfeed_plain: optimize utf8-decoding and column position calculation
Optimize for the common-case: assuming ASCII.
The input is assumed to be valid UTF-8 input (output of sfeed).
This saves 2 function calls for determining the width of a single ASCII
character, which of course is 1.
Ranges:
< 32 are control-characters and are skipped.
< 127 is typical ASCII and is 1 column wide.
>= 127 is the normal path (control-character and multi-byte UTF-8).
Tested on OpenBSD and Linux with various compilers (clang, gcc, pcc and tcc).
On OpenBSD and Linux glibc much improvement. On Linux musl (almost) no change.
In a common-case upto 40% performance improvement.
In the worst-case negligible performance degration (<1%).
Diffstat (limited to 'README')
0 files changed, 0 insertions, 0 deletions