From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Newsgroups: gmane.emacs.help Subject: Re: Running process with grep-find interface is very slow Date: Wed, 31 Aug 2011 08:18:02 +0000 (UTC) Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1314778724 23070 80.91.229.12 (31 Aug 2011 08:18:44 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 31 Aug 2011 08:18:44 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 31 10:18:40 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qyg0N-000217-Px for geh-help-gnu-emacs@m.gmane.org; Wed, 31 Aug 2011 10:18:39 +0200 Original-Received: from localhost ([::1]:41339 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qyg0K-0004Yk-77 for geh-help-gnu-emacs@m.gmane.org; Wed, 31 Aug 2011 04:18:36 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:48146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qyg07-0004WM-TN for help-gnu-emacs@gnu.org; Wed, 31 Aug 2011 04:18:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qyg06-0005TE-Qw for help-gnu-emacs@gnu.org; Wed, 31 Aug 2011 04:18:23 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:36269) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qyg06-0005SC-AQ for help-gnu-emacs@gnu.org; Wed, 31 Aug 2011 04:18:22 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Qyfzy-0001js-8r for help-gnu-emacs@gnu.org; Wed, 31 Aug 2011 10:18:14 +0200 Original-Received: from 84-236-127-24.pool.digikabel.hu ([84.236.127.24]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 31 Aug 2011 10:18:14 +0200 Original-Received: from adatgyujto by 84-236-127-24.pool.digikabel.hu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 31 Aug 2011 10:18:14 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 29 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 84.236.127.24 (Opera/9.80 (Windows NT 6.1; U; en) Presto/2.9.168 Version/11.50) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:82099 Archived-At: Tom gmail.com> writes: > > Why is it so much slower to run the same command via grep than > via the command line? > Turns out it was the way I ran the command. I created a small convenience function which always started the search from the root directory of the project (let ((default-directory rootdir)) (grep-find (concat "c:/xampp/perl/bin/perl.exe c:/bin/ack -i " pattern))) Looks like default-directory caused the problem, because if I change it to this: (with-current-buffer (find-file-noselect rootdir) (grep-find (concat "c:/xampp/perl/bin/perl.exe c:/bin/ack -i " pattern))) then it's not slow anymore. It fixed the problem, though I don't really get the difference. Isn't setting default-directory temporarily a usual way to make a directory current for the duration of a function?