aboutsummaryrefslogtreecommitdiff
path: root/benchtests
AgeCommit message (Collapse)AuthorFilesLines
2024-11-29benchtests: Add calloc testWangyang Guo5-5/+64
Two new benchmarks related to calloc added: - bench-calloc-simple - bench-calloc-thread Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2024-11-22benchtests: Add tanf benchmarkAdhemerval Zanella2-0/+3006
Random inputs in [-pi, pi]. Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-22benchtests: Add lgammaf benchmarkAdhemerval Zanella2-0/+1006
Random inputs in the range [-20.0,20.0]. Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-22benchtests: Add erfcf benchmarkAdhemerval Zanella2-0/+796
It is based on binary64 erfc-inputs, with random inputs in [0,b=0x1.41bbf6p+3] where b in the smallest number such that erfcf(b) rounds to 0 (to nearest). Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-22benchtests: Add erff benchmarkAdhemerval Zanella2-0/+796
It is based on binary64 erf-inputs, with random inputs in [0,b=0x1.f5a888p+1] where b in the smallest number such that erff(b) rounds to 1 (to nearest). Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-22benchtests: Add cbrtf benchmarkAdhemerval Zanella2-0/+1006
Based on binary64 benchtests, with random inputs in [1,8].
2024-11-01benchtests: Add log10p1f benchmarkAdhemerval Zanella2-0/+2889
It is based on log2f data. Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-01benchtests: Add log1p benchmarkAdhemerval Zanella2-0/+1006
Random inputs x*2^e where x is random in [1/2,1] and e in [-29,127]. Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-01benchtests: Add log2p1f benchmarkAdhemerval Zanella2-0/+2889
It is based on log2f data. Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-01benchtests: Add log10f benchmarkAdhemerval Zanella2-0/+1006
The inputs are random numbers in the form x*2^e where x is random in [0x1p-1,0x1p+0] and e in [-126,127]. Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-01benchtests: Add expm1f benchmarkAdhemerval Zanella2-0/+800
The inputs are modeled based on expm1-inputs, with the range adapted to binary32 range. Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-01benchtests: Add exp2m1f benchmarkAdhemerval Zanella2-0/+2389
The input is based on exp2f benchmark. Reviewed-by: DJ Delorie <dj@redhat.com>
2024-11-01benchtests: Add exp10m1f benchmarkAdhemerval Zanella2-0/+2390
The input is based on exp10f benchmark. Reviewed-by: DJ Delorie <dj@redhat.com>
2024-10-11replace tgammaf by the CORE-MATH implementationPaul Zimmermann2-0/+1007
The CORE-MATH implementation is correctly rounded (for any rounding mode). This can be checked by exhaustive tests in a few minutes since there are less than 2^32 values to check against for example GNU MPFR. This patch also adds some bench values for tgammaf. Tested on x86_64 and x86 (cfarm26). With the initial GNU libc code it gave on an Intel(R) Core(TM) i7-8700: "tgammaf": { "": { "duration": 3.50188e+09, "iterations": 2e+07, "max": 602.891, "min": 65.1415, "mean": 175.094 } } With the new code: "tgammaf": { "": { "duration": 3.30825e+09, "iterations": 5e+07, "max": 211.592, "min": 32.0325, "mean": 66.1649 } } With the initial GNU libc code it gave on cfarm26 (i686): "tgammaf": { "": { "duration": 3.70505e+09, "iterations": 6e+06, "max": 2420.23, "min": 243.154, "mean": 617.509 } } With the new code: "tgammaf": { "": { "duration": 3.24497e+09, "iterations": 1.8e+07, "max": 1238.15, "min": 101.155, "mean": 180.276 } } Signed-off-by: Alexei Sibidanov <sibid@uvic.ca> Signed-off-by: Paul Zimmermann <Paul.Zimmermann@inria.fr> Changes in v2: - include <math.h> (fix the linknamespace failures) - restored original benchtests/strcoll-inputs/filelist#en_US.UTF-8 file - restored original wrapper code (math/w_tgammaf_compat.c), except for the dealing with the sign - removed the tgammaf/float entries in all libm-test-ulps files - address other comments from Joseph Myers (https://sourceware.org/pipermail/libc-alpha/2024-July/158736.html) Changes in v3: - pass NULL argument for signgam from w_tgammaf_compat.c - use of math_narrow_eval - added more comments Changes in v4: - initialize local_signgam to 0 in math/w_tgamma_template.c - replace sysdeps/ieee754/dbl-64/gamma_productf.c by dummy file Changes in v5: - do not mention local_signgam any more in math/w_tgammaf_compat.c - initialize local_signgam to 1 instead of 0 in w_tgamma_template.c and added comment Changes in v6: - pass NULL as 2nd argument of __ieee754_gammaf_r in w_tgammaf_compat.c, and check for NULL in e_gammaf_r.c Changes in v7: - added Signed-off-by line for Alexei Sibidanov (author of the code) Changes in v8: - added Signed-off-by line for Paul Zimmermann (submitted of the patch) Changes in v9: - address comments from review by Adhemerval Zanella Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-08-07benchtests: Add random memset benchmarkWilco Dijkstra2-0/+186
Add a new randomized memset test similar to bench-random-memcpy. Instead of repeating the same call to memset over and over again, it times a large number of different inputs. The distribution of memset length and alignment is based on SPEC2017 (length up to 4096 and alignment up to 64). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-06-21Benchtests: Remove broken walk benchmarksWilco Dijkstra6-581/+0
The walk benchmarks don't measure anything useful - memory is not initialized properly so doing a single walk in 32MB just measures reading the 4KB zero page for reads and clear_page overhead for writes. The memset variants don't even manage to do a walk in the 32MB region due to using incorrect pointer increments... Neither is it clear why it is walking backwards since this won't confuse modern prefetchers. If you fix the benchmark and print the bandwidth, the results are identical for all sizes larger than ~1KB since it is just testing memory bandwidth of a single 32MB block. This case is already tested by the large benchmark, so overall it doesn't seem useful to keep these. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2024-06-15Modernize and fix doc’s “Date and Time” (BZ 31876)Paul Eggert1-1/+1
POSIX.1-2024 (now official) specifies tm_gmtoff and tm_zone. This is a good time to update the manual’s “Date and Time” chapter so I went through it, fixed some outdated stuff that had been in there for decades, and improved it to match POSIX.1-2024 better and to clarify some implementation-defined behavior. Glibc already conforms to POSIX.1-2024 in these matters, so this is merely a documentation change. * manual/examples/strftim.c: Use snprintf instead of now-deprecated function asctime. Check for localtime failure. Simplify by using puts instead of fputs. Prefer ‘buf, sizeof buf’ to less-obvious ‘buffer, SIZE’. * manual/examples/timespec_subtract.c: Modernize to use struct timespec not struct timeval, and rename from timeval_subtract.c. All uses changed. Check for overflow. Do not check for negative return value, which ought to be OK since negative time_t is OK. Use GNU indenting style. * manual/time.texi: Document CLOCKS_PER_SEC, TIME_UTC, timespec_get, timespec_getres, strftime_l. Document the storage lifetime of tm_zone and of tzname. Caution against use of tzname, timezone and daylight, saying that these variables have unspecified values when TZ is geographic. This is what glibc actually does (contrary to what the manual said before this patch), and POSIX is planned to say the same thing <https://austingroupbugs.net/view.php?id=1816>. Also say that directly accessing the variables is not thread-safe. Say that localtime_r and ctime_r don’t necessarily set time zone state. Similarly, in the tzset documentation, say that it is called by ctime, localtime, mktime, strftime, not that it is called by all time conversion functions that depend on the time zone. Say that tm_isdst is useful mostly just for mktime, and that other uses should prefer tm_gmtoff and tm_zone instead. Do not say that strftime ignores tm_gmtoff and tm_zone, because it doesn’t do that. Document what gmtime does to tm_gmtoff and tm_zone. Say that the asctime, asctime_r, ctime, and ctime_r are now deprecated and/or obsolescent, and that behavior is undefined if the year is < 1000 or > 9999. Document strftime before these now-obsolescent functions, so that readers see the useful function first. Coin the terms “geographical format” and “proleptic format” for the two main formats of TZ settings, to simplify exposition. Use this wording consistently. Update top-level proleptic syntax to match POSIX.1-2024, which glibc already implements. Document the angle-bracket quoted forms of time zone abbreviations in proleptic TZ. Say that time zone abbreviations can contain only ASCII alphanumerics, ‘+’, and ‘-’. Document what happens if the proleptic form specifies a DST abbreviation and offset but omits the rules. POSIX says this is implementation-defined so we need to document it. Although this documentation mentions ‘posixrules’ tersely, we need to rethink ‘posixrules’ since I think it stops working after 2038. Clarify wording about TZ settings beginning with ‘;’. Say that timegm is in ISO C (as of C23). Say that POSIX.1-2024 removed gettimeofday. Say that tm_gmtoff and tm_zone are extensions to ISO C, which is clearer than saying they are invisible in a struct ISO C enviroment, and gives us more wiggle room if we want to make them visible in strict ISO C, something that ISO C allows. Drop mention of old standards like POSIX.1c and POSIX.2-1992 in the text when the history is so old that it’s no longer useful in a general-purpose manual. Define Coordinated Universal Time (UTC), time zone, time zone ruleset, and POSIX Epoch, and use these phrases more consistently. Improve TZ examples to show more variety, and to reflect current practice and timestamps. Remove obsolete example about Argentina. Add an example for Ireland. Don’t rely on GCC extensions when explaining ctime_r. Do not say that difftime produces the mathematically correct result, since it might be inexact. For clock_t don’t say “as in the example above” when there is no such example, and don’t say that casting to double works “properly and consistently no matter what”, as it suffers from rounding and overflow. Don’t say broken-down time is not useful for calculations; it’s merely painful. Say that UTC is not defined before 1960. Rename Time Zone Functions to Time Zone State. All uses changed. Update Internet RFC 822 → 5322, 1305 → 5905. Drop specific years of ISO 8601 as they don’t matter. Minor style changes: @code{"..."} → @t{"..."} to avoid overquoting in info files, @code → @env for environment variables, Daylight Saving Time → daylight saving time, white space → whitespace, prime meridian → Prime Meridian.
2024-05-16benchtests: Add fclose benchmarkH.J. Lu3-0/+82
Measure duration of 100 fclose calls after opening 1 million FILEs. Signed-off-by: H.J. Lu <hjl.tools@gmail.com> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2024-04-24benchtests: Add difficult strstr needle for bruteforce algorithmsWilco Dijkstra1-0/+27
Add another difficult needle to strstr that clearly shows the quadratic complexity of bruteforce algorithms. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-04-18benchtests: Add random() benchmarkWilco Dijkstra2-0/+107
Add a simple benchmark to measure the overhead of internal libc locks in the random() implementation on both single- and multi-threaded cases. This relies on the implementation of random using internal locks to access shared global data, and that the runtime uses multi-threaded locking once a thread has been created (even after it finishes). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-04-01benchtests: Improve benchtests for strstrAdhemerval Zanella1-76/+273
Use same strategy as bench-strstr.c (93eebae5168e5cf2 and 80b2bfb53504) and use json_ctx for output to help standardize format across all benchtests. Reviewed-by: Arjun Shankar <arjun@redhat.com>
2024-02-23benchtests: Add more benchtests for rounding functions.Junxian Zhu12-0/+233
This patch adds more benchtests for rounding functions. The double inputs are copied from trunc-inputs, the float inputs are copied from truncf-inputs. and the rintf is copied from rint-inputs. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-01-12Benchtests: Increase benchmark iterationsWilco Dijkstra2-2/+2
Increase benchmark iterations for math and vector math functions to improve timing accuracy. Vector math benchmarks now take 1-3 seconds on a modern CPU. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2024-01-01Update copyright dates with scripts/update-copyrightsPaul Eggert102-102/+102
2023-06-22benchtests: fix warn unused resultFrederic Berat1-1/+5
Few tests needed to properly check for asprintf and system calls return values with _FORTIFY_SOURCE enabled. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2023-06-02Fix all the remaining misspellings -- BZ 25337Paul Pluzhnikov3-5/+5
2023-05-18benchtests: Reformat Makefile.Carlos O'Donell1-15/+32
Reflow all long lines adding comment terminators. Sort all reflowed text using scripts/sort-makefile-lines.py. No regressions running microbenchmarks. No code generation changes observed in binary artifacts. No regressions on x86_64 and i686.
2023-05-03Enable libmvec support for AArch64Joe Ramsay1-0/+88
This patch enables libmvec on AArch64. The proposed change is mainly implementing build infrastructure to add the new routines to ABI, tests and benchmarks. I have demonstrated how this all fits together by adding implementations for vector cos, in both single and double precision, targeting both Advanced SIMD and SVE. The implementations of the routines themselves are just loops over the scalar routine from libm for now, as we are more concerned with getting the plumbing right at this point. We plan to contribute vector routines from the Arm Optimized Routines repo that are compliant with requirements described in the libmvec wiki. Building libmvec requires minimum GCC 10 for SVE ACLE. To avoid raising the minimum GCC by such a big jump, we allow users to disable libmvec if their compiler is too old. Note that at this point users have to manually call the vector math functions. This seems to be acceptable to some downstream users. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
2023-04-17Benchtests: Adjust timingWilco Dijkstra11-11/+11
Adjust iteration counts so benchmarks don't run too slowly or quickly. Ensure benchmarks take less than 10 seconds on older, slower cores and more than 0.5 seconds on fast cores. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-04-04compare_strings.py : Add --gmean flagNisha Menon1-2/+18
To calculate geometric mean for string benchmark results. Signed-off-by: Nisha Poyarekar <nisha.s.menon@gmail.com>
2023-04-03benchtests: Add fmodf benchmarkAdhemerval Zanella Netto2-0/+2183
1. Subnormals: 128 inputs. 2. Normal numbers with large exponent difference (|x/y| > 2^8): 1024 inputs between FLT_MIN and FLT_MAX; 3. Close exponents (ey >= -103 and |x/y| < 2^8): 1024 inputs with exponents between -10 and 10. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2023-04-03benchtests: Add fmod benchmarkAdhemerval Zanella Netto2-0/+2183
Add three different dataset, from random floating point numbers: 1. Subnormals: 128 inputs. 2. Normal numbers with large exponent difference (|x/y| > 2^52): 1024 inputs between DBL_MIN and DBL_MAX; 3. Close exponents (ey >= -907 and |x/y| < 2^52): 1024 inputs with exponents between -10 and 10. Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2023-03-27benchtests: Move libmvec benchtest inputs to benchtests directoryJoe Ramsay52-0/+213200
This allows other targets to use the same inputs for their own libmvec microbenchmarks without having to duplicate them in their own subdirectory. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
2023-03-08Benchtests: Remove simple_str(r)chrWilco Dijkstra2-31/+38
Instead of benchmarking slow byte oriented loops, include the optimized generic strchr and strrchr implementation. Adjust iteration count to reduce benchmark time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-03-08Benchtests: Remove simple_str(n)casecmpWilco Dijkstra2-37/+2
Remove the slow byte oriented loops. Adjust iteration count to reduce benchmark time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-03-08Benchtests: Remove simple_memcmpWilco Dijkstra1-31/+1
Remove the slow byte oriented simple_memcmp. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-03-08Benchtests: Remove simple_strcspn/strpbrk/strsepWilco Dijkstra5-177/+4
Remove simple_strcspn/strpbrk/strsep which are significantly slower than the generic implementations. Also remove oldstrsep and oldstrtok since they are practically identical to the generic implementation. Adjust iteration count to reduce benchmark time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-03-08Benchtests: Remove memchr_strnlenWilco Dijkstra2-11/+2
Remove memchr_strnlen since it is now the same as generic_strnlen. Adjust iteration count to reduce benchmark time. Keep memchr_strlen since the generic strlen does not use memchr. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-03-08Benchtests: Remove simple_mem(r)chrWilco Dijkstra2-30/+26
Instead of benchmarking slow byte oriented loops, include the optimized generic memchr/memrchr implementation. Adjust iteration count to reduce benchmark time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-03-08Benchtests: Remove simple_strcpy_chkWilco Dijkstra2-27/+1
Remove the slow byte oriented simple_strcpy_chk and simple_stpcpy_chk. Adjust iteration count to increase benchmark time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-03-08Benchtests: Remove simple_str(n)cmpWilco Dijkstra2-74/+24
Instead of benchmarking slow byte oriented loops, include the optimized generic strcmp/strncmp implementation. Adjust iteration count to reduce benchmark time. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-02-06Replace rawmemchr (s, '\0') with strchrWilco Dijkstra2-2/+2
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 Myers101-101/+101
2022-11-08benchtests: Make str{n}{cat|cpy} benchmarks output jsonNoah Goldstein4-115/+297
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 Goldstein1-9/+9
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 Zanella1-3/+3
Reviewed-by: Fangrui Song <maskray@google.com>
2022-10-19Bench: Improve benchtests for memchr, strchr, strnlen, strrchrNoah Goldstein5-45/+137
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 Goldstein6-12/+151
Reuses infrastructure from previous pthread_mutex_lock benchmarks to test other performance sensitive functions.
2022-09-28Benchtest: Add additional benchmarks for strlen and strnlenNoah Goldstein2-7/+81
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 Netto5-3/+230
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.