all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Running process with grep-find interface is very slow
@ 2011-08-31  6:48 Tom
  2011-08-31  6:52 ` Tom
  2011-08-31  8:18 ` Tom
  0 siblings, 2 replies; 4+ messages in thread
From: Tom @ 2011-08-31  6:48 UTC (permalink / raw)
  To: help-gnu-emacs

I often have to search large codebases and I use Ack for that
which is a better grep as it calls itself. I want to use the grep-find 
interface with ack, so I can jump to matches easily and it's working, 
but it's really slow.

When I run ack on the command line then it returns the
results in seconds, and if the files are cached by the OS then
it returns the results instantly.

But if I'm running the same command with the grep interface:

   (grep-find "c:/xampp/perl/bin/perl.exe c:/bin/ack -i somestuff")


then it takes minutes for the results appear in the grep buffer,
and when I'm running the same search again immediately when the OS
still have the files cached, even then it takes 30-40 seconds for
the results to appear.

Why is it so much smaller to run the same command via grep than
via the command line?


It's GNU Emacs 23.2.1 (i386-mingw-nt6.1.7601) on Windows.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Running process with grep-find interface is very slow
  2011-08-31  6:48 Running process with grep-find interface is very slow Tom
@ 2011-08-31  6:52 ` Tom
  2011-08-31  8:18 ` Tom
  1 sibling, 0 replies; 4+ messages in thread
From: Tom @ 2011-08-31  6:52 UTC (permalink / raw)
  To: help-gnu-emacs

Tom <adatgyujto <at> gmail.com> writes:
> 
> Why is it so much smaller to run the same command via grep than
> via the command line?
> 

I mean slower, of course.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Running process with grep-find interface is very slow
  2011-08-31  6:48 Running process with grep-find interface is very slow Tom
  2011-08-31  6:52 ` Tom
@ 2011-08-31  8:18 ` Tom
  2011-09-27  3:48   ` Kevin Rodgers
  1 sibling, 1 reply; 4+ messages in thread
From: Tom @ 2011-08-31  8:18 UTC (permalink / raw)
  To: help-gnu-emacs

Tom <adatgyujto <at> 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?





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Running process with grep-find interface is very slow
  2011-08-31  8:18 ` Tom
@ 2011-09-27  3:48   ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2011-09-27  3:48 UTC (permalink / raw)
  To: help-gnu-emacs

On 8/31/11 2:18 AM, Tom wrote:
> Tom<adatgyujto<at>  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?

Yes.  Could you profile the grep-*, compile-*, and compilation-*
functions with elp.el under both scenarios to show where the performance
problem occurs?

-- 
Kevin Rodgers
Denver, Colorado, USA




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-09-27  3:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-31  6:48 Running process with grep-find interface is very slow Tom
2011-08-31  6:52 ` Tom
2011-08-31  8:18 ` Tom
2011-09-27  3:48   ` Kevin Rodgers

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.