Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932068AbbGAOHu (ORCPT ); Wed, 1 Jul 2015 10:07:50 -0400 Received: from mail-la0-f53.google.com ([209.85.215.53]:33708 "EHLO mail-la0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753990AbbGAOHm (ORCPT ); Wed, 1 Jul 2015 10:07:42 -0400 MIME-Version: 1.0 In-Reply-To: References: <20150628163252.GA1991@p183.telecom.by> <20150628164403.GA7169@p183.telecom.by> Date: Wed, 1 Jul 2015 17:07:40 +0300 Message-ID: Subject: Re: [PATCH] un-improve strrchr() From: Alexey Dobriyan To: Chris Rorvick Cc: Andrew Morton , Linux Kernel , Rasmus Villemoes Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1214 Lines: 28 On Wed, Jul 1, 2015 at 2:52 AM, Chris Rorvick wrote: > [ resending w/o HTML formatting ] > > On Sun, Jun 28, 2015 at 11:44 AM, Alexey Dobriyan wrote: >> Previous code did 1 branch per character + 1 branch for every character >> in the last path component. Current code does 2 branches per characher >> regardless. > > Shouldn't that be "+ 2 branches for every character in the last path > component"? The structure of the loop is basically the same; you're > just performing fewer iterations if the character is found when > searching from the end. Yes, changelog is inaccurate. It is "1 branch per character + 2 branches per character in the last path component" vs "2 branches per character". Rasmus posted benchmark (obvious rdtsc/strrchr/rdtsc) in private. Speed highly depends on -O2/-Os setting and current mainline code is not uniformly faster at least for me. I'll probably resend with new and improved changelog. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/