[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

code issues in sort.c

From: David Feuer
Subject: code issues in sort.c
Date: Sat, 16 Jul 2005 22:31:25 -0400
User-agent: Mutt/1.5.9i

sort.c does a whole lot of fancy stuff, but lacks explanations for it.
Even the most basic question, "why does sort use a merge sort", is not
answered.  I tried to find out by reading through the archives of
bug-coreutils and bug-textutils, but failed.  Maybe this is obvious to
everyone else, but not to me (I start to wonder if a more trieish
sorting algorithm might win sometimes).

Some extreme hairiness:

My understanding is limited, but it looks like numbers may be
recomputed for -g every time two lines are compared.  Once these
numbers are calculated, they should really be stored.

default_sort_size does not give any meaningful explanation of the
hard-coded constants it contains, or of much else for that matter.

sort_buffer_size has a comment saying, among other things, "Do not
exceed a bound on the size: if the bound is not specified by the user,
use a default."  This is less than illuminating.

Temporary files are not deleted immediately upon creation: is there a
reason for this?

I don't see documentation on what exactly the temporary files are _for_.

The entire program is smashed into one file, with all the constants
and global variables on top.  It would be far easier to understand
what is going on if it were broken up into pieces, so the global
variables relating to a particular function could appear somewhere
remotely near it.

David Feuer

reply via email to

[Prev in Thread] Current Thread [Next in Thread]