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
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
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
Add parentheses around macro arguments used beside operators,
or use constexpr for simple constants.
Bug: 28705665
Change-Id: I378c8aad92d3ec8e8c4b0440b5c2c99dfe01ce79
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
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