summaryrefslogtreecommitdiff
path: root/benchmarks/stdio_benchmark.cpp
AgeCommit message (Collapse)Author
2020-10-22Make more use of benchmark::DoNotOptimize in benchmarks.Elliott Hughes
A lot of these benchmarks predate DoNotOptimize and rolled their own hacks. Bug: http://b/148307629 Test: ran benchmarks before & after and got similar results Change-Id: If44699d261b687f6253af709edda58f4c90fb285
2018-11-14switch to using android-base/file.h instead of android-base/test_utils.hMark Salyzyn
Test: compile Bug: 119313545 Change-Id: I664fb32522d01909c603d7b903475c4e9aea9223
2018-08-02Modernize codebase by replacing NULL with nullptrYi Kong
Fixes -Wzero-as-null-pointer-constant warning. Test: m Bug: 68236239 Change-Id: I5b4123bc6709641315120a191e36cc57541349b2
2018-01-19Address a bunch of clang-tidy complaints.Elliott Hughes
There were a bunch more unreasonable/incorrect ones, but these ones seemed legit. Nothing very interesting, though. Bug: N/A Test: ran tests, benchmarks Change-Id: If66971194d4a7b4bf6d0251bedb88e8cdc88a76f
2017-12-19More benchmarks.Elliott Hughes
Add a hand-rolled maps line parser as something to compare our realistic sscanf benchmark against. Also add benchmarks for the ato*/strto* family. This patch doesn't fix the tests, which seem to have been broken by the recent google-benchmark upgrade despite the benchmarks themselves all working just fine. To me that's a final strike against these tests which are hard to maintain and not obviously useful, but we can worry about what to do with them -- whether to just delete them or to try to turn them into tests that actually have some value -- in a separate CL. Bug: N/A Test: ran benchmarks Change-Id: I6c9a77ece98d624baeb049b360876ef5c35ea7f2
2017-12-11Trivial scanf benchmarks.Elliott Hughes
Bug: http://b/68672236 Test: ran benchmarks Change-Id: I96514be5e67969b65205e953051c524be3626ec4
2017-11-30Generate all the benchmarks to run.Christopher Ferris
Instead of requiring the need to maintain a list of all the benchmarks, add a programmatic way to generate all of the benchmarks. This generation runs the benchmarks in alphabetical order. Add a new macro BIONIC_BENCHMARK_WITH_ARG that will be the default argument to pass to the benchmark. Change the benchmarks that require default arguments. Add a small example xml file, and remove the full.xml/host.xml files. Update readme. Test: Ran new unit tests, verified all tests are added. Change-Id: I8036daeae7635393222a7a92d18f34119adba745
2017-11-0310x printf speedup.Elliott Hughes
Android is UTF-8. Don't make everyone pay to convert UTF-8 to ASCII just so we can recognize '%'. With UTF-8 we can just strchr forwards. Before: --------------------------------------------------------------- Benchmark Time CPU Iterations --------------------------------------------------------------- BM_stdio_printf_literal 1290 ns 1290 ns 442554 BM_stdio_printf_s 1204 ns 1204 ns 582446 BM_stdio_printf_d 1206 ns 1206 ns 578311 BM_stdio_printf_1$s 2263 ns 2263 ns 310002 After: --------------------------------------------------------------- Benchmark Time CPU Iterations --------------------------------------------------------------- BM_stdio_printf_literal 178 ns 178 ns 3394001 BM_stdio_printf_s 246 ns 246 ns 2850284 BM_stdio_printf_d 252 ns 252 ns 2778610 BM_stdio_printf_1$s 363 ns 363 ns 1929011 Add missing __find_arguments error checking to the wide variant to match the regular one. Also replace various char/wchar_t differences with the macro. Bug: http://b/67371539 Test: ran tests Change-Id: I18f122009c22699943ab5d666a98ea594a972c40
2017-10-26Add basic printf benchmarks.Elliott Hughes
Bug: http://b/67371539 Test: ran benchmarks Change-Id: I6ad05540079776b2df4cc8d9c02440c61e42037d
2017-08-23Benchmark fgetln(3) and getline(3) as well as fgets(3).Elliott Hughes
On Pixel 2016, there's about 1us overhead for getline versus fgets. fgetln(3) is worse still because of the intermediate buffering (though it might actually be better if you were only reading one line whose length was less than BUFSIZ). Also use somewhat realistic input for these benchmarks: /dev/zero makes no sense at all. Bug: N/A Test: ran benchmarks Change-Id: I4a319825a37ac3849014c4c6b31523c1e200c641
2017-08-23Fix the stdio fwrite benchmark.Elliott Hughes
Can't write to a read-only file. (Mode "rw" isn't meaningful, but isn't considered an error by any libc I know of.) Bug: http://b/64585477 Test: ran benchmarks Change-Id: Ifec1d68414bfc8f3cc8d7f912cb135dccb2e7a41
2017-08-09Improve error handling and fix minor bugs in bionic benchmarks.Anders Lewis
Test: Unit tests. Change-Id: I224ae4c7f195176eb8a87deddb2debcbf0f24ba3
2017-08-09Add musl benchmarks.Anders Lewis
Test: Unit tests. Change-Id: Ifb2911825f84b95fe64a803bfabd32fb81210eae
2017-08-07Implement interface for bionic benchmarks.Anders Lewis
Test: Unit tests. Change-Id: Ic61932f61ddd572e2f045b601f9da6e090cdc45d
2016-11-15Fix deprecated range_x() calls.Martijn Coenen
Test: builds with new libbenchmark. Change-Id: I91c0e5c1b5cf75b8e551f3c59d83ac9352817c4a
2016-06-10Fix misc-macro-parentheses warnings in bionic.Chih-Hung Hsieh
Add parentheses around macro arguments used beside operators, or use constexpr for simple constants. Bug: 28705665 Change-Id: I378c8aad92d3ec8e8c4b0440b5c2c99dfe01ce79
2016-03-07Switch bionic over to google-benchmark.Elliott Hughes
Also removes the old benchmarking library. Change-Id: I4791ae69fa5dea03644d3d411c60b7c6d1fceae3
2015-05-13Fix unused result errors in bionic.Elliott Hughes
This lets us use _FORTIFY_SOURCE=2 on the host. Change-Id: I69f5ff9834bfd595aae6584104bee10c4d8a5eeb
2015-02-19Refactor the benchmark code.Christopher Ferris
Changes: - Modify the benchmarks to derive from a single Benchmark object. - Rewrite the main iteration code. This includes changing the iteration code to use the actual total time calculated by the benchmark as a basis for determining whether there are enough iterations instead of using the time it takes to run the benchmark. - Allow benchmarks to take no argument, int, or double. - Fix the PrettyInt printer for negative integers. - Modify the max column width name to include the whole name including the arg part. - Reformat property_benchmark.cpp in line with the rest of the code. - Modify a few of the math benchmarks to take an argument instead of separate benchmarks for the same function with different args. - Create a vector of regex_t structs to represent the args all at once instead of when running each benchmark. This change is in preparation for adding new math based benchmarks. Tested by running on a nexus flo running at max using the new code and the old code and comparing. All of the numbers are similar, but some of the iterations are different due to the slightly different algorithm used. Change-Id: I57ad1f3ff083282b9ffeb72e687cab369ce3523a
2015-01-21Implement __fsetlocking.Elliott Hughes
The old __isthreaded hack was never very useful on Android because all user code runs in a VM where there are lots of threads running. But __fsetlocking lets a caller say "I'll worry about the locking for this FILE*", which is useful for the normal case where you don't share a FILE* between threads so you don't need any locking. Bug: 17154740 Bug: 18593728 Change-Id: I2a8dddc29d3edff39a3d7d793387f2253608a68d
2015-01-16Add a benchmark for using stdio to read a file in /proc.Elliott Hughes
Change-Id: I12517aae19e36b7c022a11e8807aece61bb0cb9c
2014-12-01Benchmark fread/fwrite both buffered and unbuffered.Elliott Hughes
Bug: 18556607 Change-Id: I53905aedcea75fe550d9c423fb701c2c9bf8e831
2014-03-11Add various benchmarks.Elliott Hughes
These are based on ones from system/extras/tests/bionic/. Change-Id: I7b1ae15a2ca5d1031a6a511d97b88125c1770047