From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by sourceware.org (Postfix) with ESMTPS id 7ACB83858C39 for ; Wed, 8 Dec 2021 23:10:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7ACB83858C39 Received: by mail-pg1-x52b.google.com with SMTP id 71so3401342pgb.4 for ; Wed, 08 Dec 2021 15:10:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=WU67GlrxyQyF2XTzCUGTVXjXHStxfQxPeijPu6I80Bw=; b=2kIyt+E+6SbJDX5tDHlo/SHnRhHvgp9zp4HMW9It2p/LZoVnFUT++LtSsOnYxmOHBY r/CfH8Kw7hThPX2KUK5B7iUN04AM6HMPPFQEDrI4tjxYBL6Est2AqmxRA207IFrLQJx/ HukYxEJMtF4kzwjCbGz+9Tf0Wb3iGCADRMpmaWmnezTuArXpkk7e/LUNemE5cN5Un1Kb hKwyJNzRoVsvStHVQl6AKSI62py8ltUXiAugIwX4DyT7acTlndjQl1uORiobHlhK3Gjj vlUOw+Sh38JfeKAdvir/XOtBLARUsqKEBRGzhscIxHdtpNvwtiL/Bw3Rf5cTFEZbTLQ/ ZHFQ== X-Gm-Message-State: AOAM533cLkArVeQuz1V84wmXUU4QnyVSxdw3fgN2P5OidBasCAswQppr zoOapaA0OA19DH6QaVQO5LI= X-Google-Smtp-Source: ABdhPJwynBL8s1Yt4gduiuOJXOL0qcbN444NcZpITpjUrqaLe0fd2MD4ciY6TE2zztEqEXTK5enQeg== X-Received: by 2002:a63:9d01:: with SMTP id i1mr13618028pgd.560.1639005056651; Wed, 08 Dec 2021 15:10:56 -0800 (PST) Received: from [192.168.1.15] (65-130-80-28.slkc.qwest.net. [65.130.80.28]) by smtp.gmail.com with ESMTPSA id bt2sm6959382pjb.33.2021.12.08.15.10.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Dec 2021 15:10:56 -0800 (PST) Message-ID: <5c681731-49de-f6f1-87e6-5edee67e4a6d@gmail.com> Date: Wed, 8 Dec 2021 16:10:54 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH] pch: Add support for relocation of the PCH data [PR71934] Content-Language: en-US To: Iain Sandoe , Jakub Jelinek Cc: Richard Biener , gcc-patches@gcc.gnu.org References: <20211207095507.GV2646553@tucnak> <20211207145007.GX2646553@tucnak> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Dec 2021 23:10:59 -0000 On 12/8/2021 1:00 AM, Iain Sandoe wrote: > >> On 7 Dec 2021, at 14:50, Jakub Jelinek via Gcc-patches wrote: >> >> On Tue, Dec 07, 2021 at 10:55:07AM +0100, Jakub Jelinek via Gcc-patches wrote: >>> So, this patch instead builds a relocation table (sorted list of addresses >>> in the blob which needs relocation) at PCH save time, stores it in a very >>> compact form into the gch file and upon restore, adjusts pointers in GTY >>> roots (that is right away in the root structures) and the addresses in the >>> relocation table. >>> The cost on stdc++.gch/O2g.gch (previously 85MB large) is about 3% file size >>> growth, there are 2.5 million pointers that need relocation in the gch blob >>> and the relocation table uses uleb128 for address deltas and needs ~1.01 bytes >>> for one address that needs relocation, and about 20% compile time during >>> PCH save (I think it is mainly because of the need to qsort those 2.5 >>> million pointers). On PCH restore, if it doesn't need relocation (the usual >>> case), it is just an extra fread of sizeof (size_t) data and fseek >>> (in my tests real time on vanilla tree for #include CU >>> was ~0.175s and with the patch but no relocation ~0.173s), while if it needs >>> relocation it took ~0.193s, i.e. 11.5% slower. >> I'll note that without PCH that >> #include >> int i; >> testcase compiles with -O2 -g in ~1.199s, i.e. 6.2 times slower than PCH with >> relocation and 6.9 times than PCH without relocation. > I’ve run tests across the Darwin range, including old and new m32 hosts, and this > seems to be working well. > > The attached patch should be applied before (or merged with) the change for > relocation when it is applied - since the operation of the PCH hooks needs some > adjustment on Darwin. > > thanks for working on this! I think as the Darwin maintainer, you can just commit this once Jakub commits his bits. jeff