From 9507fa2c9545156747a5eb248bc1af3159bfd8c8 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Thu, 29 Oct 2015 15:08:57 -0700 Subject: Change a few places to use string version of GetTypeId GetTypeId is about 20% faster than GetStringId + integer GetTypeID since it does less binary searches. Change-Id: I876c4ac89ab206acca217b2287b0197ef2e408c2 --- runtime/dex_file.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'runtime/dex_file.cc') diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc index b3ca6ac131..3a93aace83 100644 --- a/runtime/dex_file.cc +++ b/runtime/dex_file.cc @@ -738,11 +738,7 @@ bool DexFile::CreateTypeList(const StringPiece& signature, uint16_t* return_type } // TODO: avoid creating a std::string just to get a 0-terminated char array std::string descriptor(signature.data() + start_offset, offset - start_offset); - const DexFile::StringId* string_id = FindStringId(descriptor.c_str()); - if (string_id == nullptr) { - return false; - } - const DexFile::TypeId* type_id = FindTypeId(GetIndexForStringId(*string_id)); + const DexFile::TypeId* type_id = FindTypeId(descriptor.c_str()); if (type_id == nullptr) { return false; } -- cgit v1.2.3-59-g8ed1b