Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Dec 2009 16:16:48 GMT
From:      Stepan Koltsov <yozh@mx1.ru>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/141920: sort -k 3,1g is very slow
Message-ID:  <200912231616.nBNGGmYI012674@www.freebsd.org>
Resent-Message-ID: <200912231620.nBNGK1wC006946@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         141920
>Category:       misc
>Synopsis:       sort -k 3,1g is very slow
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 23 16:20:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Stepan Koltsov
>Release:        7.2
>Organization:
>Environment:
7.2-STABLE amd64
>Description:
sort -k 3,1g is very slow.
>How-To-Repeat:
1. Generate a file:

for i in {1..10000}; do echo 1261583423 a a; done > txt

(10000 lines "1261583423 a a")

2. Run sort with simpler options:

time cat txt | sort -k 3,1 > /dev/null
time cat txt | sort -k 3,1n > /dev/null
time cat txt | sort -k 1g > /dev/null
time cat txt | sort -k 2,1g > /dev/null

All these commands work fast (in 0.03s).

3. Run sort wih -k 3,1g:

time cat txt | sort -k 3,1g > /dev/null

It takes 4 seconds. It is too long.
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912231616.nBNGGmYI012674>