delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/05/18:27:22

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <26224019.post@talk.nabble.com>
Date: Thu, 5 Nov 2009 15:27:07 -0800 (PST)
From: aputerguy <nabble AT kosowsky DOT org>
To: cygwin AT cygwin DOT com
Subject: 1.7] BUG - GREP slows to a crawl with large number of matches on a single file
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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: http://old.nabble.com/1.7--BUG---GREP-slows-to-a-crawl-with-large-number-of-matches-on-a-single-file-tp26224019p26224019.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019