Use transparent lookups in ExtensionRegistry in order to avoid initializing all the fields in the lookup key in FindRegisteredExtension.

PiperOrigin-RevId: 663037843
diff --git a/src/google/protobuf/extension_set.cc b/src/google/protobuf/extension_set.cc
index 9ec6f92..3ba79d6 100644
--- a/src/google/protobuf/extension_set.cc
+++ b/src/google/protobuf/extension_set.cc
@@ -52,16 +52,32 @@
 
 // Registry stuff.
 
+struct ExtensionInfoKey {
+  const MessageLite* message;
+  int number;
+};
+
 struct ExtensionEq {
+  using is_transparent = void;
   bool operator()(const ExtensionInfo& lhs, const ExtensionInfo& rhs) const {
     return lhs.message == rhs.message && lhs.number == rhs.number;
   }
+  bool operator()(const ExtensionInfo& lhs, const ExtensionInfoKey& rhs) const {
+    return lhs.message == rhs.message && lhs.number == rhs.number;
+  }
+  bool operator()(const ExtensionInfoKey& lhs, const ExtensionInfo& rhs) const {
+    return lhs.message == rhs.message && lhs.number == rhs.number;
+  }
 };
 
 struct ExtensionHasher {
+  using is_transparent = void;
   std::size_t operator()(const ExtensionInfo& info) const {
     return absl::HashOf(info.message, info.number);
   }
+  std::size_t operator()(const ExtensionInfoKey& info) const {
+    return absl::HashOf(info.message, info.number);
+  }
 };
 
 using ExtensionRegistry =
@@ -85,7 +101,7 @@
                                              int number) {
   if (!global_registry) return nullptr;
 
-  ExtensionInfo info;
+  ExtensionInfoKey info;
   info.message = extendee;
   info.number = number;