misc/141920: sort -k 3,1g is very slow

Stepan Koltsov yozh at mx1.ru
Wed Dec 23 16:20:02 UTC 2009


>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:


More information about the freebsd-bugs mailing list