From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122627 invoked by alias); 17 Apr 2019 18:18:42 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 122619 invoked by uid 89); 17 Apr 2019 18:18:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=reorganize X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Apr 2019 18:18:41 +0000 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 472FCC05FBAF; Wed, 17 Apr 2019 18:18:40 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-54.rdu2.redhat.com [10.10.112.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5097E5C220; Wed, 17 Apr 2019 18:18:38 +0000 (UTC) Subject: Re: [PATCH][RFC] Improve get_qualified_type linear list walk To: Richard Biener , gcc-patches@gcc.gnu.org Cc: Jakub Jelinek References: From: Jeff Law Openpgp: preference=signencrypt Message-ID: <52598ebb-fe58-fa8f-976e-8c21f5980055@redhat.com> Date: Wed, 17 Apr 2019 18:25:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00730.txt.bz2 On 4/16/19 6:55 AM, Richard Biener wrote: > > The following makes the C++ FEs heavy use of build_qualified_type > cheaper. When looking at a tramp3d -fsyntax-only compile you can > see that for 470.000 build_qualified_type calls we end up > with 9.492.205 calls to check_qualified_type (thus we visit around > 20 variant type candidates) ending up finding it in all but > 15.300 cases that end up in build_variant_type_copy. > > That's of course because the FE uses this machinery to do things like > > bool > same_type_ignoring_top_level_qualifiers_p (tree type1, tree type2) > { > if (type1 == error_mark_node || type2 == error_mark_node) > return false; > > type1 = cp_build_qualified_type (type1, TYPE_UNQUALIFIED); > type2 = cp_build_qualified_type (type2, TYPE_UNQUALIFIED); > return same_type_p (type1, type2); > > but so it be. The improvement is to re-organize get_qualified_type > to put found type variants on the head of the variant list. This > improves the number of calls to check_qualified_type to 1.215.030 > thus around 2.5 candidates. > > Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. > > Comments? OK? > > Richard. > > 2019-04-16 Richard Biener > > * tree.c (get_qualified_type): Put found type variants at the > head of the variant list. Seems quite reasonable to me. I just hope we don't find a case where this is the exact worst case behavior ;-) jeff