Faster Signature::operator==(const StringPiece& rhs).
Avoid string allocation and resizing, return early if
a parameter doesn't match.
Change-Id: Ifc929d0c4a7a9d368432f7cae797d4326c6c44be
diff --git a/runtime/dex_file.h b/runtime/dex_file.h
index 84026a4..69593cd 100644
--- a/runtime/dex_file.h
+++ b/runtime/dex_file.h
@@ -964,10 +964,7 @@
return !(*this == rhs);
}
- bool operator==(const StringPiece& rhs) const {
- // TODO: Avoid temporary string allocation.
- return ToString() == rhs;
- }
+ bool operator==(const StringPiece& rhs) const;
private:
Signature(const DexFile* dex, const DexFile::ProtoId& proto) : dex_file_(dex), proto_id_(&proto) {