From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D6AE23858D28 for ; Mon, 19 Sep 2022 13:46:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D6AE23858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663595169; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iiUNAEu6H8KDeTFbOJs1JEOXD6NncmGNGsM/Ck5GZe4=; b=b21RIwx6jDNMU6UzBl2AveI54zOFQdF5l68LXvGTzNvNSf1wFpdXgzRbRJN+KTKSmJ8FZt cMtTbrtOOq+1qZMwzeTuQJg8WRvaUAweww2bMEp8/UZ2HnI+aFBDhNyfE6ldN2oqxPMELz wc29jFe6Ss6FeqJjg5HJ99HXsxqCScE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-604-JPKFXK1QO_GoM0MaWxUObg-1; Mon, 19 Sep 2022 09:46:06 -0400 X-MC-Unique: JPKFXK1QO_GoM0MaWxUObg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 088F5185A794; Mon, 19 Sep 2022 13:46:06 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.137]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EFF3A140EBF3; Mon, 19 Sep 2022 13:46:04 +0000 (UTC) From: Florian Weimer To: Jakub Jelinek Cc: Jason Merrill , Michael Matz , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] libgcc: Decrease size of _Unwind_FrameState and even more size of cleared area in uw_frame_state_for References: <87czbrhg1y.fsf@oldenburg.str.redhat.com> Date: Mon, 19 Sep 2022 15:46:03 +0200 In-Reply-To: (Jakub Jelinek's message of "Mon, 19 Sep 2022 11:33:37 +0200") Message-ID: <87zgevfpes.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Jakub Jelinek: > On Mon, Sep 19, 2022 at 11:25:13AM +0200, Florian Weimer wrote: >> * Jakub Jelinek: >> >> > The disadvantage of the patch is that touching reg[x].loc and how[x] >> > now means 2 cachelines rather than one as before, and I admit beyond >> > bootstrap/regtest I haven't benchmarked it in any way. Florian, could >> > you retry whatever you measured to get at the 40% of time spent on the >> > stack clearing to see how the numbers change? >> >> A benchmark that unwinds through 100 frames containing a std::string >> variable goes from (0b5b8ac5cb7fe92dd17ae8bd7de84640daa59e84): >> >> min: 24418 ns >> 25%: 24740 ns >> 50%: 24790 ns >> 75%: 24840 ns >> 95%: 24937 ns >> 99%: 26174 ns >> max: 42530 ns >> avg: 24826.1 ns >> >> to (0b5b8ac5cb7fe92dd17ae8bd7de84640daa59e84 with this patch): >> >> min: 22307 ns >> 25%: 22640 ns >> 50%: 22713 ns >> 75%: 22787 ns >> 95%: 22948 ns >> 99%: 24839 ns >> max: 52658 ns >> avg: 22863.4 ns >> >> So 227 ns per frame instead of 248 ns per frame, or ~9% less. > > Thanks for doing that. So it turns out my test program had 100 frames, but not with std::string. With std::string objects, the numbers are: Before: min: 71236 ns 25%: 71637 ns 50%: 71724 ns 75%: 71857 ns 95%: 73148 ns 99%: 74023 ns max: 120735 ns avg: 71973.1 ns After: min: 69547 ns 25%: 69961 ns 50%: 70034 ns 75%: 70112 ns 95%: 71273 ns 99%: 71511 ns max: 82691 ns avg: 70121.3 ns So slightly less improvement per frame, but it's still there. >> Moving cfa_how after how in struct frame_state_reg_info as an 8-bit >> bitfield should avoid zeroing another 8 bytes. This shaves off another >> 3 ns per frame in my testing (on a Core i9-10900T, so with ERMS). > > Good idea. Won't help always, on some targets how could have size divisible > by pointer alignment, but when it is at the end it always increases the > size by alignment of pointer, while after how array it only does so if > how is multiple of pointer alignment. Okay, I'll send a separate patch once yours is in, along with some other simple changes. Thanks, Florian