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.129.124]) by sourceware.org (Postfix) with ESMTPS id 2F9333858C83 for ; Mon, 7 Feb 2022 10:41:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2F9333858C83 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-447-Tn9ho4-RM3y8rIQDjyhT8Q-1; Mon, 07 Feb 2022 05:40:57 -0500 X-MC-Unique: Tn9ho4-RM3y8rIQDjyhT8Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9ED051006AA0; Mon, 7 Feb 2022 10:40:56 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.193.205]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F3367D70E; Mon, 7 Feb 2022 10:40:55 +0000 (UTC) From: Florian Weimer To: "H.J. Lu via Libc-alpha" Subject: Re: [PATCH] elf: Replace memcmp with __memcmpeq for variable size References: <20220206210914.1593336-1-hjl.tools@gmail.com> <874k5b3afx.fsf@mid.deneb.enyo.de> Date: Mon, 07 Feb 2022 11:40:53 +0100 In-Reply-To: (H. J. Lu via Libc-alpha's message of "Sun, 6 Feb 2022 16:20:34 -0800") Message-ID: <87tudbklhm.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 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.1 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, T_SCC_BODY_TEXT_LINE 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Feb 2022 10:41:02 -0000 * H. J. Lu via Libc-alpha: >> benefits come from. None of the changed spots look particularly hot >> to me. > > These are noises. Here are the new data: > > The cycles to run "elf/tst-relsort1 --direct" which calls __memcmpeq > 24 times in ld.so: > > Before: > > 62704: > 62704: runtime linker statistics: > 62704: total startup time in dynamic loader: 130771 cycles > 62704: time needed for relocation: 32153 cycles (24.5%) > 62704: number of relocations: 97 > 62704: number of relocations from cache: 3 > 62704: number of relative relocations: 1347 > 62704: time needed to load objects: 43704 cycles (33.4%) > 62704: > 62704: runtime linker statistics: > 62704: final number of relocations: 131 > 62704: final number of relocations from cache: 3 > > After: > > 62705: > 62705: runtime linker statistics: > 62705: total startup time in dynamic loader: 117103 cycles > 62705: time needed for relocation: 28327 cycles (24.1%) > 62705: number of relocations: 97 > 62705: number of relocations from cache: 3 > 62705: number of relative relocations: 1347 > 62705: time needed to load objects: 39550 cycles (33.7%) > 62705: > 62705: runtime linker statistics: > 62705: final number of relocations: 131 > 62705: final number of relocations from cache: 3 > > These numbers change for each run. __memcmpeq has the lower > cycles. This must be something else. According to the numbers, we save ~159 between ~569 cycles per __memcmpeq call. That is just not realistic. Thanks, Florian