diff options
author | Noah Goldstein <goldstein.w.n@gmail.com> | 2022-09-28 12:20:12 -0700 |
---|---|---|
committer | Noah Goldstein <goldstein.w.n@gmail.com> | 2022-09-28 20:16:04 -0700 |
commit | 5eb21c62cea9e5879e7637ac6713ba2cb5993ca5 (patch) | |
tree | 9cda9bc9d0845f914c9cf5d8ca7200a836eda02c /benchtests/bench-strlen.c | |
parent | b0969fa53a28b4ab2159806bf6c99a98999502ee (diff) | |
download | glibc-5eb21c62cea9e5879e7637ac6713ba2cb5993ca5.tar.gz glibc-5eb21c62cea9e5879e7637ac6713ba2cb5993ca5.tar.xz glibc-5eb21c62cea9e5879e7637ac6713ba2cb5993ca5.zip |
Benchtest: Add additional benchmarks for strlen and strnlen
Current benchmarks are missing many cases in the mid-length range which is often the hottest size range.
Diffstat (limited to 'benchtests/bench-strlen.c')
-rw-r--r-- | benchtests/bench-strlen.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/benchtests/bench-strlen.c b/benchtests/bench-strlen.c index 602e52ee83..696e4541d7 100644 --- a/benchtests/bench-strlen.c +++ b/benchtests/bench-strlen.c @@ -128,10 +128,10 @@ test_main (void) /* Checking with only 4 * N alignments for wcslen, other alignments are wrong for wchar_t type arrays*/ for (i = 1; i < 8; ++i) - { - do_test (&json_ctx, sizeof (CHAR) * i, i); - do_test (&json_ctx, 0, i); - } + { + do_test (&json_ctx, sizeof (CHAR) * i, i); + do_test (&json_ctx, 0, i); + } for (i = 2; i <= 12; ++i) { @@ -141,6 +141,31 @@ test_main (void) do_test (&json_ctx, sizeof (CHAR) * i, (size_t)((1 << i) / 1.5)); } + for (i = 0; i < 512; i += 32) + { + do_test (&json_ctx, 0, i / sizeof (CHAR)); + } + + for (i = 512; i < 1024; i += 64) + { + do_test (&json_ctx, 0, i / sizeof (CHAR)); + } + + for (i = 1024; i < 2048; i += 128) + { + do_test (&json_ctx, 0, i / sizeof (CHAR)); + } + + for (i = 2048; i < 4096; i += 256) + { + do_test (&json_ctx, 0, i / sizeof (CHAR)); + } + + for (i = 4096; i < 8192; i += 512) + { + do_test (&json_ctx, 0, i / sizeof (CHAR)); + } + json_array_end (&json_ctx); json_attr_object_end (&json_ctx); json_attr_object_end (&json_ctx); |