aboutsummaryrefslogtreecommitdiff
path: root/benchtests/bench-strchr.c
diff options
context:
space:
mode:
authornoah <goldstein.w.n@gmail.com>2021-02-03 00:39:00 -0500
committerH.J. Lu <hjl.tools@gmail.com>2021-02-08 11:34:00 -0800
commita00e2fe3dfd3a4e218ba6c1c3445ee68322ddda9 (patch)
tree3b6ca4910217d3b5d05e879831183cd9772ea050 /benchtests/bench-strchr.c
parent1f745ecc2109890886b161d4791e1406fdfc29b8 (diff)
downloadglibc-a00e2fe3dfd3a4e218ba6c1c3445ee68322ddda9.tar
glibc-a00e2fe3dfd3a4e218ba6c1c3445ee68322ddda9.tar.gz
glibc-a00e2fe3dfd3a4e218ba6c1c3445ee68322ddda9.tar.bz2
glibc-a00e2fe3dfd3a4e218ba6c1c3445ee68322ddda9.zip
strchr: Add additional benchmarks and tests
This patch adds additional benchmarks and tests for string size of 4096 and several benchmarks for string size 256 with different alignments.
Diffstat (limited to 'benchtests/bench-strchr.c')
-rw-r--r--benchtests/bench-strchr.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/benchtests/bench-strchr.c b/benchtests/bench-strchr.c
index bf493fe458..4ce2369d9b 100644
--- a/benchtests/bench-strchr.c
+++ b/benchtests/bench-strchr.c
@@ -100,7 +100,7 @@ do_test (size_t align, size_t pos, size_t len, int seek_char, int max_char)
size_t i;
CHAR *result;
CHAR *buf = (CHAR *) buf1;
- align &= 15;
+ align &= 127;
if ((align + len) * sizeof (CHAR) >= page_size)
return;
@@ -153,10 +153,22 @@ test_main (void)
for (i = 1; i < 8; ++i)
{
+ do_test (0, 16 << i, 4096, SMALL_CHAR, MIDDLE_CHAR);
+ do_test (i, 16 << i, 4096, SMALL_CHAR, MIDDLE_CHAR);
+ }
+
+ for (i = 1; i < 8; ++i)
+ {
do_test (i, 64, 256, SMALL_CHAR, MIDDLE_CHAR);
do_test (i, 64, 256, SMALL_CHAR, BIG_CHAR);
}
+ for (i = 0; i < 8; ++i)
+ {
+ do_test (16 * i, 256, 512, SMALL_CHAR, MIDDLE_CHAR);
+ do_test (16 * i, 256, 512, SMALL_CHAR, BIG_CHAR);
+ }
+
for (i = 0; i < 32; ++i)
{
do_test (0, i, i + 1, SMALL_CHAR, MIDDLE_CHAR);
@@ -171,10 +183,22 @@ test_main (void)
for (i = 1; i < 8; ++i)
{
+ do_test (0, 16 << i, 4096, 0, MIDDLE_CHAR);
+ do_test (i, 16 << i, 4096, 0, MIDDLE_CHAR);
+ }
+
+ for (i = 1; i < 8; ++i)
+ {
do_test (i, 64, 256, 0, MIDDLE_CHAR);
do_test (i, 64, 256, 0, BIG_CHAR);
}
+ for (i = 0; i < 8; ++i)
+ {
+ do_test (16 * i, 256, 512, 0, MIDDLE_CHAR);
+ do_test (16 * i, 256, 512, 0, BIG_CHAR);
+ }
+
for (i = 0; i < 32; ++i)
{
do_test (0, i, i + 1, 0, MIDDLE_CHAR);