svent / sift

A fast and powerful alternative to grep
https://sift-tool.org
GNU General Public License v3.0
1.6k stars 108 forks source link

blocked when "-e ." with a big file #101

Open Pingze-github opened 6 years ago

Pingze-github commented 6 years ago

When I run "sift -e . /***/log.log -n --follow --binary-skip --limit=10", the program blocked with nothing to print.

But when I change "." to ".*", It works normally(in 30ms).

The file has about 8,000 lines.

In my opinion, "." has nothing different with ".*", why it makes the program blocked?

(version: sift 0.9.0 (windows/amd64))

svent commented 6 years ago

Thank you for your report. sift does not really block - the search just runs insanely slow, as every character in the file generates a match and those matches are later merged into one match per line. Searching for '.' is quite unusual and there is a good workaround ('.+' would be better here, as '.*' also matches empty lines), but I have to admit that this behavior is bad and should be improved.

I will leave this issue open to track this.