diff options
author | Elliott Hughes <enh@google.com> | 2017-11-03 14:00:37 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2017-11-03 14:19:00 -0700 |
commit | 5305a4d4a723b06494b93f2df81733b83a0c46d3 (patch) | |
tree | e2de767071618925487ca8b8ba2da4d7aac62fce /libc/stdio/stdio.cpp | |
parent | 232541aa02e22ab8fafcdd503c74aae22fa09699 (diff) |
10x printf speedup.
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
Diffstat (limited to 'libc/stdio/stdio.cpp')
0 files changed, 0 insertions, 0 deletions