From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by sourceware.org (Postfix) with ESMTPS id 484A43858D35 for ; Fri, 10 Dec 2021 10:50:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 484A43858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=seketeli.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=seketeli.org Received: (Authenticated sender: dodji@seketeli.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 2A9A224000B; Fri, 10 Dec 2021 10:50:49 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 623335802BD; Fri, 10 Dec 2021 11:50:49 +0100 (CET) From: Dodji Seketeli To: Matthias Maennich Cc: libabigail@sourceware.org, gprocida@google.com, kernel-team@android.com Subject: Re: [PATCH 3/5] XML writer: track emitted types by bare pointer Organization: Me, myself and I References: <20211203114622.2944173-1-maennich@google.com> <20211203114622.2944173-4-maennich@google.com> X-Operating-System: Fedora 36 X-URL: http://www.seketeli.net/~dodji Date: Fri, 10 Dec 2021 11:50:49 +0100 In-Reply-To: <20211203114622.2944173-4-maennich@google.com> (Matthias Maennich's message of "Fri, 3 Dec 2021 11:46:21 +0000") Message-ID: <87ilvwrawm.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Dec 2021 10:50:54 -0000 Hello, Matthias Maennich a =C3=A9crit: [...] > This is a performance and safety improvement made possible by the > previous changes which ensure that the same pointers are inserted and > looked up. > > This essentially removes the now unnecessary deep comparison. [...] > +++ b/src/abg-writer.cc > @@ -123,14 +123,10 @@ typedef unordered_map abigail::diff_utils::deep_ptr_eq_functor> type_ptr_map; >=20=20 > // A convenience typedef for a set of type_base*. > -typedef unordered_set - abigail::diff_utils::deep_ptr_eq_functor> > -type_ptr_set_type; > +typedef std::unordered_set type_ptr_set_type; >=20=20 > /// A convenience typedef for a set of function type*. > -typedef unordered_set - abigail::diff_utils::deep_ptr_eq_functor> > -fn_type_ptr_set_type; > +typedef std::unordered_set fn_type_ptr_set_type; The problem I see with doing this is that it's possible that two declaration-only classes, that are equivalent but that have different pointer values get into these sets. In that case, they would be considered different even though they are not. So maybe it would be better have an equality operator that uses is_non_canonicalized_type() to detect those rare cases and use structural comparison in those cases? What do you think? --=20 Dodji