Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8083032rwi; Tue, 25 Oct 2022 02:09:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7OLktLDnfPXptDzBJ+Tc5ITegwaNkOlZxUfOix6aoOiLckBsBfQ98A9r9fMfP70Ra29zDj X-Received: by 2002:a17:906:db0e:b0:77b:82cf:54a6 with SMTP id xj14-20020a170906db0e00b0077b82cf54a6mr30873620ejb.691.1666688967918; Tue, 25 Oct 2022 02:09:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666688967; cv=none; d=google.com; s=arc-20160816; b=vEaLY48uAmZl2lqEkLXmZZpcv8GCpmsGSzHEh0vbdr5gQz+VqJUEcfy53+2XdEXDXG 5dbQizMSa7jVsFofZdofud6RXVzNmzMxYvM37GYlOE6K5G7I24qirGr88mLtuBxupYB8 6vLJxjLJ2zRHF3eFXqHuct8bSqxkzXFOKaUarJKAsa/tC/g/slvRsDP086ISMC4Fwg5X AyfYmYNYm1/nMVC9XLbBHxOZJlnBaiVswD75YCtnlMzPPVRjsPTKuyKr1ohTmJ722RjH CONJIgXb6UdxpzuVMRgHJZ/dgpz3A7gg5bqosNs8O0MJclc6HN1n11lsFwq8NPoW3GIx Hy3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=X2MERZ5VlFhEOjKs95JGTZ6qjTA4o46YpyBQChG/NcA=; b=Xt4ms6h5+YZWj4Gmj5SX3+YMi3Rccyy7aSU9LtdFzyKu3wJuUS5Dbs70DNbAwLbUCd K+pFppMLIRcTg6kYq9/Cs8FIbgCSMkDrt8QzB8b0JCFE57HwGBfWxqbS2hiDhq3PKESW WtbWONgthZIuJ19mGNhTuq/ogcGcRhEbxGFk17TtOw6/ZORqnLwt4n2+oB6JXXWdLrtL OvuElprlr1Xpm4R6fmbgey2y51BHhTCUvS43vmCKYLwKBU3eZiM2tzKZGc1ghkYsy3yV HafhuOmAkHJ5U+4gDcVi2MXdA5kuvgxP4XjqaO3iet9w0IFTEyFPkM/z+h7J0DFby60z 24uw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m25-20020a1709066d1900b007919388d2c6si1360108ejr.357.2022.10.25.02.09.01; Tue, 25 Oct 2022 02:09:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231977AbiJYJG3 (ORCPT + 99 others); Tue, 25 Oct 2022 05:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232065AbiJYJEv (ORCPT ); Tue, 25 Oct 2022 05:04:51 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CB1015A336 for ; Tue, 25 Oct 2022 02:03:56 -0700 (PDT) X-IronPort-AV: E=McAfee;i="6500,9779,10510"; a="307621657" X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="307621657" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2022 02:03:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10510"; a="700469060" X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="700469060" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga004.fm.intel.com with ESMTP; 25 Oct 2022 02:03:41 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1onFqW-001ukj-1p; Tue, 25 Oct 2022 12:03:40 +0300 Date: Tue, 25 Oct 2022 12:03:40 +0300 From: Andy Shevchenko To: Nathan Moinvaziri Cc: "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] lib/string.c: Improve strcasecmp speed by not lowering if chars match Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_SOFTFAIL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 25, 2022 at 11:00:36AM +0300, Andy Shevchenko wrote: > On Tue, Oct 25, 2022 at 4:46 AM Nathan Moinvaziri wrote: ... > > When running tests using Quick Benchmark with two matching 256 character > > strings these changes result in anywhere between ~6-9x speed improvement. > > > > * We use unsigned char instead of int similar to strncasecmp. > > * We only subtract c1 - c2 when they are not equal. ... > You tell us that this is more preformant, but have not provided the > numbers. Can we see those, please? So, I have read carefully and see the reference to some QuickBenchmark I have no idea about. What I meant here is to have numbers provided by an (open source) tool (maybe even in-kernel test case) that anybody can test on their machines. You also missed details about how you run, what the data set has been used, etc. > Note, that you basically trash CPU cache lines when characters are not > equal, and before doing that you have a branching. I'm unsure that > your way is more performant than the original one. -- With Best Regards, Andy Shevchenko