tech-userlevel archive

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

Re: Using mmap(2) in sort(1) instead of temp files



>> [...]
> Why not stat the input file and decide to use in memory iff the file
> is small enough?  This way sort will handle large sorts on small
> memory machines automatically.

Well, I'm not the one (putatively) doing the work.  But my answers to
that are:

(1) Small sorts are not the issue, IMO.  Even a speedup as great as
halving the time taken is not enough to worry about when it's on a par
with the cost of starting sort(1) at all.

(2) Using mmap versus read provides minimal speedup in this sort of
case: a small file which is being read sequentially.

(3) Code complexity: two paths means twice the testing, twice the
opportunities for bugs, (slightly more than) twice the maintenance,
etc.

(4) Are there still incoherencies between mmap and read/write access?
At one time there were, and I never got a good handle on what needed to
be done to avoid them.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index