From: Morten Welinder Date: Tue, 16 May 2006 02:10:38 GMT Subject: Re: Fix silly typo in new builtin grep Message-ID: <118833cc0605151910s7619ddf0x8f014adba2a1eba5@mail.gmail.com> In-Reply-To: If I read the code right, it calls regexec for every single character on every single line. No wonder that takes a while! Just call it once and it'll search for its match quite nicely. If that's not enough, the two obvious optimizations are... 1. If the pattern contains no regexp characters (and that is very common), do a strstr. 2. If the pattern must start with a specific character, search for that by itself. M.