From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by sourceware.org (Postfix) with ESMTPS id 93A3E3858417 for ; Tue, 8 Feb 2022 23:00:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 93A3E3858417 Received: by mail-oi1-x22e.google.com with SMTP id t199so663295oie.10 for ; Tue, 08 Feb 2022 15:00:40 -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=ICKwLzQhMp+LY6UIJyA1gDvhNBrq0isdH1N+lBnWQEg=; b=5/ksISZGOWl4NszhqmXpLE7VDZd3diOmLbgwNQIWf8ZVeDAsfII7vKQIwt8J+JXfxN nbLTMs4pxeNQX5x1q34u0ze4aQJdxvamC6GiMUUQCqC+KObGIjBNg/4AsU/gpeBnumxG 96yIZFLZNVaFC5rWjBP/OG0RGY8XEn7OMXclsy02LNPY4TE655VB/KwEKIggcSAMlLHB 1pXmDz0mAeCdsH+HBVIfnAsNE84p+tD68xTIy9mQNo2xn9brzp0B4XkQfM/n5nvYCcow 28BF1Fsqgcws3UbEBW0PBSnPHbpbB1sBNMXxlBPAAkq32HFDdIetGMf3qMQ3eY+Alp0y rpRg== X-Gm-Message-State: AOAM531E32hhtaMVj/5xZrG8fwaaEOKG4WFS/NRRKnh1kD+a9hdBjY3p mFTdKTFUNGe3gQsLKzHEOBE0oP70dcd+VQ== X-Google-Smtp-Source: ABdhPJxYyXsXP03zp4BkfzIKRBlm+ekFk2TDSU6cHJ9D6Xgn5qt9GuF+b/rln993Ds/iuXgA8hePsw== X-Received: by 2002:a54:4519:: with SMTP id l25mr110864oil.97.1644361240027; Tue, 08 Feb 2022 15:00:40 -0800 (PST) Received: from ?IPV6:2804:431:c7ca:733:86a9:ad5:adef:2f3e? ([2804:431:c7ca:733:86a9:ad5:adef:2f3e]) by smtp.gmail.com with ESMTPSA id d22sm5686774otp.79.2022.02.08.15.00.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Feb 2022 15:00:39 -0800 (PST) Message-ID: Date: Tue, 8 Feb 2022 20:00:37 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH] elf: Replace memcmp with __memcmpeq for variable size Content-Language: en-US To: Wilco Dijkstra , "H.J. Lu" Cc: 'GNU C Library' References: From: Adhemerval Zanella In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: Tue, 08 Feb 2022 23:00:42 -0000 On 08/02/2022 19:30, Wilco Dijkstra via Libc-alpha wrote: > Hi, > >>>  My understanding is this optimization would eventually be implemented by >> >> What kinds of codes should compilers generate?  For glibc internal >> usage, we can write codes in such a way that the generated codes >> are very similar to what compilers should generate. >> >>>  the compiler, so maybe it would be better to let it optimize if suitable >>>  (similar to what we are aiming for math code). > > I agree with Joseph that these kind of micro-optimizations are generally counter productive - > we've removed many similar hacks from math libraries resulting in good speedups (they > almost always work against you, blocking compiler optimizations such as inlining, constant > propagation etc). It's much better to improve code via algorithm or implementation > optimizations rather than focus on these micro-optimizations. > > As mentioned, codesize will increase since many applications now use both memcmp and > __memcmpeq, and the extra I-cache misses may wipe out any savings. This was also mine and Florian's view on this specific optimization back on Monday's call.