Diagnosing a slow grep or ack search through a complex directory (code, files, php scripts, etc.) For faster reuse

I use ack (sometimes distributed as ack-grep) to search a complex code directory, images, who knows what else, and it reacts rather slowly. How can I diagnose what he is looking for, which makes him slow so that I can ignore him?

I only realized that the reasons why my ack-grep is slow will probably make grep slow for the same reason, so I changed the name of the title to refer to both.

The current alias for the ack-grep command is:

function view ()
{
echo "ack-grep -i $@ // ignoring third-party directories"
ack-grep -i --ignore-dir=third-party --ignore-dir="unclean-files" --ignore-dir=FCKeditor --ignore-dir=smarty --ignore-dir=codepress --ignore-dir=yui "$@"
}

So, I am doing a case insensitive search on some line through this alias, for example. view "Oops! Required fields"ignoring some directories.

I assume that I can really use the “verbose” mode for grep or ack-grep so that I can visually see the subdirectories that it hangs around because they are slowly looking.

+5
source share
2 answers

The use of the -L switch has been completed so that it displays all the files that it matches for a quick visual diagnosis of problems. Only the command structure below is used:

ack-grep -L "Oops! Required fields were not all completed."

+4
source

What are you looking for? If this is only a source of a certain type (let's say you're looking for a variable), use the appropriate switch (for perl, use --perl, etc.). If you have tons of sources, it will take some time, no matter what you do.

Ack-grep , . , ? Regex , -, . , .

+1

All Articles