liblog: event_tag_map use unordered_map
>3 times faster access for lookup functions. Code simplification and C++ coding style conversion. android_lookupEventTagNum has been expanded to utilize the Format match, and then drops down to just Tag match. Performance testing on Hikey, all services stopped, shell only access, CPU not locked had good repeatability. $ adb reboot ; adb wait-for-device ; adb shell su root stop Before this adjustment using binary search: $ /data/nativetest64/liblog-benchmarks/liblog-benchmarks BM_lookupEvent* iterations ns/op Precharge: start Precharge: stop 231 BM_lookupEventTag 10000000 153 BM_lookupEventTag_NOT 20000000 139 BM_lookupEventFormat 10000000 153 After this adjustment strictly using std::unordered_map lookup: $ /data/nativetest64/liblog-benchmarks/liblog-benchmarks BM_lookupEvent* iterations ns/op Precharge: start Precharge: stop 231 BM_lookupEventTag 50000000 56 BM_lookupEventTag_NOT 100000000 21 BM_lookupEventFormat 50000000 56 Test: gTest logd-unit-tests and liblog-unit-tests, liblog-benchmarks. Bug: 31456426 Change-Id: I1cfc3d641c3ea9ab08d455efe0c844d3a6381440
Loading
Please register or sign in to comment