Make some more fixups

This commit is contained in:
Justine Tunney 2022-06-12 09:37:17 -07:00
parent 6070a53e89
commit 4ddfc47d6e
18 changed files with 81 additions and 259 deletions

View file

@ -384,28 +384,33 @@ BENCH(printf, bench) {
char b[128];
int snprintf_(char *, size_t, const char *, ...) asm("snprintf");
EZBENCH2("ksnprintf fmt", donothing, ksnprintf(b, 128, "."));
EZBENCH2("kusnprintf fmt", donothing, kusnprintf(b, 128, "."));
EZBENCH2("snprintf fmt", donothing, snprintf_(b, 128, "."));
EZBENCH2("kusnprintf str", donothing,
kusnprintf(b, 128, "%s\n", "hello world"));
EZBENCH2("ksnprintf str", donothing,
ksnprintf(b, 128, "%s\n", "hello world"));
EZBENCH2("snprintf str", donothing,
snprintf_(b, 128, "%s\n", "hello world"));
EZBENCH2("kusnprintf utf8", donothing,
kusnprintf(b, 128, "%s\n", "天地玄黄宇宙洪荒天地玄黄宇宙洪荒"));
EZBENCH2("ksnprintf utf8", donothing,
ksnprintf(b, 128, "%s\n", "天地玄黄宇宙洪荒天地玄黄宇宙洪荒"));
EZBENCH2("snprintf utf8", donothing,
snprintf_(b, 128, "%s\n", "天地玄黄宇宙洪荒天地玄黄宇宙洪荒"));
EZBENCH2("kusnprintf chinese", donothing,
kusnprintf(b, 128, "%hs\n", u"天地玄黄宇宙洪荒"));
EZBENCH2("ksnprintf chinese", donothing,
ksnprintf(b, 128, "%hs\n", u"天地玄黄宇宙洪荒"));
EZBENCH2("snprintf chinese", donothing,
snprintf_(b, 128, "%hs\n", u"天地玄黄宇宙洪荒"));
EZBENCH2("kusnprintf astral", donothing,
kusnprintf(b, 128, "%hs\n", u"𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷"));
EZBENCH2("ksnprintf astral", donothing,
ksnprintf(b, 128, "%hs\n", u"𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷"));
EZBENCH2("snprintf astral", donothing,
snprintf_(b, 128, "%hs\n", u"𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷"));
EZBENCH2("kusnprintf octal", donothing,
kusnprintf(b, 128, "%#lo", ULONG_MAX));
EZBENCH2("kusnprintf long", donothing, kusnprintf(b, 128, "%ld", LONG_MAX));
EZBENCH2("ksnprintf octal", donothing, ksnprintf(b, 128, "%#lo", ULONG_MAX));
EZBENCH2("snprintf octal", donothing, snprintf(b, 128, "%#lo", ULONG_MAX));
EZBENCH2("ksnprintf long", donothing, ksnprintf(b, 128, "%ld", LONG_MAX));
EZBENCH2("snprintf long", donothing, snprintf_(b, 128, "%ld", LONG_MAX));
EZBENCH2("kusnprintf thou", donothing, kusnprintf(b, 128, "%'ld", LONG_MAX));
EZBENCH2("ksnprintf thou", donothing, ksnprintf(b, 128, "%'ld", LONG_MAX));
EZBENCH2("snprintf thou", donothing, snprintf_(b, 128, "%'ld", LONG_MAX));
EZBENCH2(
"ksnprintf bin", donothing,
ksnprintf(b, 128, "%#.*hhs\n", 8, "\001\002\003\004\005\006\007\008"));
EZBENCH2(
"snprintf bin", donothing,
snprintf(b, 128, "%`'.*hhs\n", 8, "\001\002\003\004\005\006\007\008"));
}