Make minor performance improvement to HTTP parser

redbean's message parser now takes 300 nanoseconds to parse a standard
request sent by chrome, whereas it previous took 600 nanoseconds.
This commit is contained in:
Justine Tunney 2021-03-28 18:00:29 -07:00
parent 3c19b6e352
commit 52565e7af3
6 changed files with 140 additions and 43 deletions

View file

@ -30,8 +30,11 @@ noinline size_t uint64toarray_radix10(uint64_t i, char a[hasatleast 21]) {
size_t j;
j = 0;
do {
a[j++] = i % 10 + '0';
i /= 10;
struct {
uint64_t q, r;
} x = {i / 10, i % 10};
a[j++] = x.r + '0';
i = x.q;
} while (i > 0);
a[j] = '\0';
reverse(a, j);