From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 24 08:12:15 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B79771065670; Fri, 24 Feb 2012 08:12:15 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from mo-p00-ob6.rzone.de (mo-p00-ob6.rzone.de [IPv6:2a01:238:20a:202:53f0::1]) by mx1.freebsd.org (Postfix) with ESMTP id 205B78FC17; Fri, 24 Feb 2012 08:12:14 +0000 (UTC) X-RZG-AUTH: :JiIXek6mfvEEUpFQdo7Fj1/zg48CFjWjQv0cW+St/nW/avgusCdvwXOZ/NA7x/bslx4UOSLYuW7Bwv8PtjkoBcppeXE= X-RZG-CLASS-ID: mo00 Received: from britannica.bec.de ([2001:6f8:13f0:0:224:d7ff:fe63:d530]) by smtp.strato.de (cohen mo38) (RZmta 27.7 AUTH) with (DHE-RSA-AES128-SHA encrypted) ESMTPA id j03f64o1O7CS8B ; Fri, 24 Feb 2012 09:12:00 +0100 (MET) Received: by britannica.bec.de (sSMTP sendmail emulation); Fri, 24 Feb 2012 09:11:51 +0100 Date: Fri, 24 Feb 2012 09:11:51 +0100 From: Joerg Sonnenberger To: freebsd-hackers@freebsd.org, hackers@freebsd.org Message-ID: <20120224081150.GB23692@britannica.bec.de> Mail-Followup-To: freebsd-hackers@freebsd.org, hackers@freebsd.org References: <1BDAF8C6-66A5-4F4F-A2CD-3928A0B10D48@bitpowder.com> <4F46E90B.2050407@delphij.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F46E90B.2050407@delphij.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Subject: Re: memmem small optimalisation X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Feb 2012 08:12:15 -0000 On Thu, Feb 23, 2012 at 05:34:03PM -0800, Xin Li wrote: > Did you benchmarked the change? Changes like this has to be done very > carefully since it's possible that the extra time spent on addition > and subtractions, when multiple by the length of the "long" string, > may actually defeat the benefit of one less byte worth memory compare > because the effect of CPU's data cache. More importantly, if the input was originally aligned, the additional byte is ~free. Joerg