This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

1.7] BUG - GREP slows to a crawl with large number of matches on a single file

Running grep on a 20MB file with ~100,000 matches takes an incredible almost
8 minutes under Cygwin 1.7 while taking just 0.2 seconds under Cygwin 1.5
(on a 2nd machine).

The following cases show how grep under 1.7 grinds to a halt as the number
of matches increases.

The data 'testfile' is a plain text file of the acl's of all the 108,000
files on my Windoze computer.

Note since the machines are different, compare relative times across cases
rather than the times between the two machines.

Case 1] Zero matches
time grep "sfsdfdsfds" testfile | wc
 0       0       0

Cygwin 1.5
real    0m0.093s
user    0m0.092s
sys     0m0.030s

Cygwin 1.7
real    0m1.353s
user    0m1.342s
sys     0m0.062s

Case 2] One match
time grep ".lesshst" testfile | wc
      1       3      29

Cygwin 1.5 (~same as zero matches)
real    0m0.234s
user    0m0.091s
sys     0m0.061s

Cygwin 1.7 (~same as zero matches)
real    0m1.499s
user    0m1.404s
sys     0m0.046s

Case 3] ~1400 matches

Cygwin 1.5 (~ same as zero matches)
time grep ".bin" testfile | wc
   1439    5661   71067

real    0m0.110s
user    0m0.076s
sys     0m0.077s

Cygwin 1.7 (~6x zero matches case
real    0m7.537s
user    0m7.341s
sys     0m0.045s

Case 4] ~16000 matches
time grep "Documents and Settings" testfile | wc
  15824  131573 1918500

Cygwin 1.5 (~same as zero matches)
real    0m0.437s
user    0m0.092s
sys     0m0.092s

Cygwin 1.7 (~50x zero matches)
real    1m14.491s
user    1m8.904s
sys     0m0.031s

Case 5] ~100,000 matches
time grep "# file" testfile | wc
 106988  510944 7930558

Cygwin 1.5 (~1.5x zero matches)

real    0m0.475s
user    0m0.154s
sys     0m0.201s

Cygwin 1.7 (~350x zero matches)
real    7m51.771s
user    7m16.810s
sys     0m0.062s

Case 6] Test that nothing wrong with file system reads or 'wc'
time cat testfile | wc
 966300 1821815 20426592

Cygwin 1.5 (approx same time as grepping zero matches)
real    0m0.344s
user    0m0.201s
sys     0m0.186s

Cygwin 1.7 (approx same time as grepping zero matches)
real    0m1.662s
user    0m1.373s
sys     0m0.138s

View this message in context:
Sent from the Cygwin list mailing list archive at

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]