aboutsummaryrefslogtreecommitdiff
path: root/benchtests
AgeCommit message (Collapse)Author
2023-02-06Replace rawmemchr (s, '\0') with strchrWilco Dijkstra
Almost all uses of rawmemchr find the end of a string. Since most targets use a generic implementation, replacing it with strchr is better since that is optimized by compilers into strlen (s) + s. Also fix the generic rawmemchr implementation to use a cast to unsigned char in the if statement. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-01-06Update copyright dates with scripts/update-copyrightsJoseph Myers
2022-11-08benchtests: Make str{n}{cat|cpy} benchmarks output jsonNoah Goldstein
Json output is easier to parse and most other benchmarks already do the same.
2022-11-08string: Add len=0 to {w}memcmp{eq} tests and benchtestsNoah Goldstein
len=0 is valid and fairly common so should be tested. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-11-01Disable use of -fsignaling-nans if compiler does not support itAdhemerval Zanella
Reviewed-by: Fangrui Song <maskray@google.com>
2022-10-19Bench: Improve benchtests for memchr, strchr, strnlen, strrchrNoah Goldstein
1. Add more complete coverage in the medium size range. 2. In strnlen remove the `1 << i` which was UB (`i` could go beyond 32/64)
2022-10-03Benchtests: Add bench for pthread_spin_{try}lock and mutex_trylockNoah Goldstein
Reuses infrastructure from previous pthread_mutex_lock benchmarks to test other performance sensitive functions.
2022-09-28Benchtest: Add additional benchmarks for strlen and strnlenNoah Goldstein
Current benchmarks are missing many cases in the mid-length range which is often the hottest size range.
2022-07-22benchtests: Add arc4random benchtestAdhemerval Zanella Netto
It shows both throughput (total bytes obtained in the test duration) and latecy for both arc4random and arc4random_buf with different sizes. Checked on x86_64-linux-gnu, aarch64-linux, and powerpc64le-linux-gnu.
2022-06-07Benchtests: Improve memrchr benchmarksNoah Goldstein
Add a second iteration for memrchr to set `pos` starting from the end of the buffer. Previously `pos` was only set relative to the beginning of the buffer. This isn't really useful for memrchr because the beginning of the search space is (buf + len). Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-06-01benchtests: Add workload name for sincosfAdhemerval Zanella
So it can show both reciprocal-throughput and latency. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-06-01benchtests: Add workload name for cosfAdhemerval Zanella
So it can show both reciprocal-throughput and latency. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-05-27benchtests: Improve benchtests for strstr, memmem, and memchrNoah Goldstein
1. Use json_ctx for output to help standardize format across all benchtests. 2. Add some additional tests to strstr and memchr expanding alignments and adding more small values. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-05-23benchtests: Improve bench-strnlen.cNoah Goldstein
1. Output results in json format so its easier to parse 2. Increase max alignment to `getpagesize () - 1` to make it possible to test page cross cases. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-05-23elf: Optimize _dl_new_hash in dl-new-hash.hNoah Goldstein
Unroll slightly and enforce good instruction scheduling. This improves performance on out-of-order machines. The unrolling allows for pipelined multiplies. As well, as an optional sysdep, reorder the operations and prevent reassosiation for better scheduling and higher ILP. This commit only adds the barrier for x86, although it should be either no change or a win for any architecture. Unrolling further started to induce slowdowns for sizes [0, 4] but can help the loop so if larger sizes are the target further unrolling can be beneficial. Results for _dl_new_hash Benchmarked on Tigerlake: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz Time as Geometric Mean of N=30 runs Geometric of all benchmark New / Old: 0.674 type, length, New Time, Old Time, New Time / Old Time fixed, 0, 2.865, 2.72, 1.053 fixed, 1, 3.567, 2.489, 1.433 fixed, 2, 2.577, 3.649, 0.706 fixed, 3, 3.644, 5.983, 0.609 fixed, 4, 4.211, 6.833, 0.616 fixed, 5, 4.741, 9.372, 0.506 fixed, 6, 5.415, 9.561, 0.566 fixed, 7, 6.649, 10.789, 0.616 fixed, 8, 8.081, 11.808, 0.684 fixed, 9, 8.427, 12.935, 0.651 fixed, 10, 8.673, 14.134, 0.614 fixed, 11, 10.69, 15.408, 0.694 fixed, 12, 10.789, 16.982, 0.635 fixed, 13, 12.169, 18.411, 0.661 fixed, 14, 12.659, 19.914, 0.636 fixed, 15, 13.526, 21.541, 0.628 fixed, 16, 14.211, 23.088, 0.616 fixed, 32, 29.412, 52.722, 0.558 fixed, 64, 65.41, 142.351, 0.459 fixed, 128, 138.505, 295.625, 0.469 fixed, 256, 291.707, 601.983, 0.485 random, 2, 12.698, 12.849, 0.988 random, 4, 16.065, 15.857, 1.013 random, 8, 19.564, 21.105, 0.927 random, 16, 23.919, 26.823, 0.892 random, 32, 31.987, 39.591, 0.808 random, 64, 49.282, 71.487, 0.689 random, 128, 82.23, 145.364, 0.566 random, 256, 152.209, 298.434, 0.51 Co-authored-by: Alexander Monakov <amonakov@ispras.ru> Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-05-23benchtests: Add benchtests for dl_elf_hash, dl_new_hash and nss_hashNoah Goldstein
Benchtests are for throughput and include random / fixed size benchmarks. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-05-06benchtests: Add wcrtomb microbenchmarkSiddhesh Poyarekar
Add a simple benchmark that measures wcrtomb performance with various locales with 1-4 byte characters. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Florian Weimer <fweimer@redhat.com>
2022-04-29benchtests: Better libmvec integrationSiddhesh Poyarekar
Improve libmvec benchmark integration so that in future other architectures may be able to run their libmvec benchmarks as well. This now allows libmvec benchmarks to be run with `make BENCHSET=bench-math`. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-04-29benchtests: Add UNSUPPORTED benchmark statusSiddhesh Poyarekar
The libmvec benchmarks print a message indicating that a certain CPU feature is unsupported and exit prematurelyi, which breaks the JSON in bench.out. Handle this more elegantly in the bench makefile target by adding support for an UNSUPPORTED exit status (77) so that bench.out continues to have output for valid tests. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-04-27benchtests: Add pthread-mutex-locks benchWangyang Guo
Benchmark for testing pthread mutex locks performance with different threads and critical sections. The test configuration consists of 3 parts: 1. thread number 2. critical-section length 3. non-critical-section length Thread number starts from 1 and increased by 2x until num of CPU cores (nprocs). An additional over-saturation case (1.25 * nprocs) is also included. Critical-section is represented by a loop of shared do_filler(), length can be determined by the loop iters. Non-critical-section is similiar to the critical-section, except it's based on non-shared do_filler(). Currently, adaptive pthread_mutex lock is tested.
2022-04-22benchtests: Improve bench-strrchrNoah Goldstein
1. Use json-lib for printing results. 2. Expose all parameters (before pos, seek_char, and max_char where not printed). 3. Add benchmarks that test multiple occurence of seek_char in the string. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25benchtests: Use json-lib in bench-strncasecmp.cNoah Goldstein
Just QOL change to make parsing the output of the benchtests more consistent. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25benchtests: Use json-lib in bench-strcasecmp.cNoah Goldstein
Just QOL change to make parsing the output of the benchtests more consistent. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25benchtests: Use json-lib in bench-strspn.cNoah Goldstein
Just QOL change to make parsing the output of the benchtests more consistent. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25benchtests: Use json-lib in bench-strpbrk.cNoah Goldstein
Just QOL change to make parsing the output of the benchtests more consistent. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25benchtests: Add random benchmark in bench-strchr.cNoah Goldstein
Add benchmark that randomizes whether return should be NULL or pointer to CHAR. The rationale is on many architectures there is a choice between a predicate execution option (i.e cmovcc on x86) or a branch. On x86 the results for cmovcc vs branch are something along the lines of the following: perc-zero, Br On Result, Time Br / Time cmov 0.10, 1, ,0.983 0.10, 0, ,1.246 0.25, 1, ,1.035 0.25, 0, ,1.49 0.33, 1, ,1.016 0.33, 0, ,1.579 0.50, 1, ,1.228 0.50, 0, ,1.739 0.66, 1, ,1.039 0.66, 0, ,1.764 0.75, 1, ,0.996 0.75, 0, ,1.642 0.90, 1, ,1.071 0.90, 0, ,1.409 1.00, 1, ,0.937 1.00, 0, ,0.999 Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-25benchtests: Use json-lib in bench-strchr.cNoah Goldstein
Just QOL change to make parsing the output of the benchtests more consistent. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-03-16benchtests: Use "=" instead of ":=" [BZ #28970]H.J. Lu
Use "=" instead of ":=" to allow sysdeps Makefiles to add more benches to bench and benchset. This fixes BZ #28970. Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
2022-03-08benchtests: make compare_strings.py accept string as attribute valueSu Lifan
Commit ac759b1fbf28a82d99afde9046f8b72c7cba5dae added attribute "overlap" to bench-memmove-walk, whose value is a string. This change makes compare_strings.py fail since benchout_strings.schema.json requires the values of attributes to be number. This patch relaxes such constraint. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-02-25benchtests: Generate .d dependency files [BZ #28922]H.J. Lu
1. Add all .o files to extra-objs. 2. Include ../Rules after extra-objs has been set. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-02-25benchtests: Remove duplicated loop in bench-bzero-walk.cH.J. Lu
Remove one of 2 identical loops in bench-bzero-walk.c. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-02-24benchtests: Add small sizes (<= 64) to bench-bzero-walk.cH.J. Lu
Small sizes (<= 64) represent large portion of memset usages with zero value. Add sizes (<= 64) to bench-bzero-walk.c to cover small sizes. Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
2022-02-23benchtests: Add benches for memset with 0 valueH.J. Lu
memset with zero as the value to set is by far the majority value (99%+ for Python3 and GCC). Add bench-memset-zero-large.c, bench-memset-zero-walk.c and bench-memset-zero.c to measure memset implementations for zeroing. Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
2022-02-08benchtests: Add benches for bzeroH.J. Lu
Add bench-bzero-large.c, bench-bzero-walk.c and bench-bzero.c.
2022-02-07benchtests: Sort benches in MakefileH.J. Lu
Put one bench per line and sort them.
2022-02-06Benchtests: Add length zero benchmark for memset in bench-memset.cNoah Goldstein
Zero is a relevant size for some workloads (roughly 5% of uses for GCC) so we should be testing it's performance as well. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-02-05Benchtests: move 'alloc_bufs' from loop in bench-memset.cNoah Goldstein
One buf allocation is sufficient. Calling `alloc_bufs' in the loop just adds unnecessary syscall overhead. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2022-02-03benchtests: Add more coverage for strcmp and strncmp benchmarksNoah Goldstein
Add more small and medium sized tests for strcmp and strncmp. As well for strcmp add option for more direct control of alignment. Previously alignment was being pushed to the end of the page. While this is the most difficult case to implement, it is far from the common case and so shouldn't be the only benchmark. Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
2022-01-01Update copyright dates with scripts/update-copyrightsPaul Eggert
I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 7061 files FOO. I then removed trailing white space from math/tgmath.h, support/tst-support-open-dev-null-range.c, and sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following obscure pre-commit check failure diagnostics from Savannah. I don't know why I run into these diagnostics whereas others evidently do not. remote: *** 912-#endif remote: *** 913: remote: *** 914- remote: *** error: lines with trailing whitespace found ... remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines
2021-11-06benchtests: Add partial overlap case in bench-memmove-walk.cNoah Goldstein
This commit adds a new partial overlap benchmark. This is generally the most interesting performance case for memmove and was missing. Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2021-11-06benchtests: Add additional cases to bench-memcpy.c and bench-memmove.cNoah Goldstein
This commit adds more benchmarks for the common memcpy/memmove benchmarks. The most signifcant cases are the half page offsets. The current versions leaves dst and src near page aligned which leads to false 4k aliasing on x86_64. This can add noise due to false dependencies from one run to the next. As well, this seems like more of an edge case that common case so it shouldn't be the only thing Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2021-11-05Revert "benchtests: Add acosf function to bench-math"Sunil K Pandey
This reverts commit 79d0fc65395716c1d95931064c7bf37852203c66.
2021-11-01benchtests: Add hypotfAdhemerval Zanella
Based on random input arguments. About 85% tuples have exponents of the two arguments close together (+-1 range). Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2021-11-01benchtests: Make hypot input randomAdhemerval Zanella
Instead of inputs based on the algorithm implementation details. About 85% tuples have exponents of the two arguments close together (+-1 range). Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2021-10-29benchtests: Add acosf function to bench-mathSunil K Pandey
Add acosf function to bench-math and copy acosf-inputs to benchtests. Motivation for this patch is to prepare for upcoming libmvec new functions. Float and double version of libmvec functions stays together. acosf-inputs file generated from acos-inputs file using following scaling formula: f = d * (FLT_MAX/DBL_MAX) Where d is input(double) and f is output(float). If scaled float value is duplicate in new input file, nextafterf() function used to find next float value, ensuring no duplicates. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2021-10-29benchtests: Improve bench-memcpy-randomWilco Dijkstra
Improve the random memcpy benchmark. Double the number of tests and increase the size of the memory region to test between 32KB and 1024KB. This improves accuracy on modern cores. Clean up formatting of the frequency array. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2021-10-27Benchtests: Add benchtests for __memcmpeqNoah Goldstein
No bug. This commit adds __memcmpeq benchmarks. The benchmarks just use the existing ones in memcmp. This will be useful for testing implementations of __memcmpeq that do not just alias memcmp.
2021-10-23bench-math: Sort and put each bench per lineH.J. Lu
Sort and put each math bench per line to prepare for new math benches. Reviewed-by: Noah Goldstein <goldstein.w.n@gmail.com>
2021-10-08benchtests: Add medium cases and increase iters in bench-memset.cNoah Goldstein
No bug. This commit adds new medium size cases for lengths in [512, 1024). As well it increase the iters to INNER_LOOP_ITERS_LARGE for more reliable results. Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
2021-10-04benchtests: Building benchmarks as static executablesH.J. Lu
Building benchmarks as static executables: ========================================= To build benchmarks as static executables, on the build system, run: $ make STATIC-BENCHTESTS=yes bench-build You can copy benchmark executables to another machine and run them without copying the source nor build directories.