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

@ -19,6 +19,7 @@
#include "libc/fmt/conv.h"
#include "libc/fmt/itoa.h"
#include "libc/limits.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
TEST(int64toarray_radix10, test) {
@ -64,3 +65,8 @@ TEST(uint128toarray_radix10, test) {
EXPECT_EQ(39, uint128toarray_radix10(INT128_MIN, buf));
EXPECT_STREQ("170141183460469231731687303715884105728", buf);
}
BENCH(itoa64radix10, bench) {
char b[21];
EZBENCH2("itoa64radix10", donothing, uint64toarray_radix10(UINT64_MAX, b));
}