From owner-freebsd-current@FreeBSD.ORG Sun Aug 22 16:11:47 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DB9D1065672 for ; Sun, 22 Aug 2010 16:11:47 +0000 (UTC) (envelope-from delphij@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 2392D8FC0A for ; Sun, 22 Aug 2010 16:11:46 +0000 (UTC) Received: by iwn36 with SMTP id 36so5579996iwn.13 for ; Sun, 22 Aug 2010 09:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=iHt57/CWRy9qkdFDwlm5HbTTxVA8zV9qFRJcL7xT8KE=; b=B/fQLA0sD+p47ggUFbg/n8tt8er4j4J4D64Fb4YHSdFi3lHYilQA6gp3YL9zNZH1vV VeEDPlYvDMBBYvXZet/Fd7Pu241AhVt0O9ex/4Jwyn0auREWvyzgaa0Mf4SrbuHvFFBS iUJqrn2zCG24rOac+taAr80v2O0DY5tA8J6Uc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=KmwjVmtiOigDQppf0SVFxuXaErLK1sHhQ5vfgOo3JiDSF2zn9zV6+YK2lrzo3oHAzi DjBxJykF8dFz4Pd0hG9boJktNzWE14QzsfcspltozaQ6yt2KFpWFTbXRh5i0nXFF/VxT Ievy1cLNqEnoCSikVWtdq1s8lPTqi0AalZGT8= MIME-Version: 1.0 Received: by 10.231.85.206 with SMTP id p14mr5101007ibl.89.1282492108934; Sun, 22 Aug 2010 08:48:28 -0700 (PDT) Received: by 10.231.146.10 with HTTP; Sun, 22 Aug 2010 08:48:28 -0700 (PDT) In-Reply-To: <86k4nikglg.fsf@ds4.des.no> References: <201008210231.o7L2VRvI031700@ducky.net> <86k4nikglg.fsf@ds4.des.no> Date: Sun, 22 Aug 2010 08:48:28 -0700 Message-ID: From: Xin LI To: =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Mike Haertel , gabor@freebsd.org, freebsd-current@freebsd.org Subject: Re: why GNU grep is fast X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2010 16:11:47 -0000 2010/8/22 Dag-Erling Sm=C3=B8rgrav : > Amen. =C2=A0The current bottleneck in BSD grep is the memchr() that looks= for > '\n' in the input buffer. FYI I actually have a rewritten memchr() which is faster than the current one here: http://people.freebsd.org/~delphij/for_review/memchr.c Review/comments welcome. I've done some preliminary validation/benchmark on this but still need to compare it with some hand optimized assembler implementations that I have seen and see if it's worthy. Cheers, --=20 Xin LI http://www.delphij.net