comp.lang.ada
 help / color / mirror / Atom feed
* sorting large numbers of large records
@ 2003-07-28 15:29 Brien L. Christesen
  2003-07-28 15:35 ` Vinzent Hoefler
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Brien L. Christesen @ 2003-07-28 15:29 UTC (permalink / raw)




First off, I'm an Ada newbie, I've only been using it for about a month
now.

I am trying to sort ~1,000,000 (with potential to grow to 60 mil)
records of 256 bytes each in Ada. The records are written to a binary
file. Right now, I read in the file, and divide it into files greater
than and less than a pivot value.  I then recursively call this division
function until it reaches a set less than 100,000 records (if I make this
number any larger I get a stack overflow on my windows box) it creates an
array of the records, calls quicksort on it, and appends the result to a
final results file.

I couldn't really find much discussion of doing external sorts in Ada (or
much literature on external sorts at all) so I'm not sure if this is a
good approach to be taking, or if there is a better way to do the sort.  I
tried creating an index, sorting the index, and then creating the results
file based on the index.  Jumping around the file with direct_io led to
awful results, though.  The execution time of the part of the code that
read the index, got the corresponding value from the large record file,
and wrote that record to a new file grew exponentially.

Does anyone know of a good way to do this kind of sort?  Thanks in advance
for any responses.



^ permalink raw reply	[flat|nested] 18+ messages in thread
* sorting large numbers of large records
@ 2003-07-29 13:10 Brien L. Christesen
  2003-07-29 14:30 ` Larry Kilgallen
  2003-07-30  0:32 ` Keith Thompson
  0 siblings, 2 replies; 18+ messages in thread
From: Brien L. Christesen @ 2003-07-29 13:10 UTC (permalink / raw)


That is a good point, and I looked into the unix sort command.  The only
problem is that as far as I can tell, that only sorts text files.  I have
a file of binary records, so I have no idea how I could use a system sort
command to do it.  Is there any way that would work?

thanks for the feedback!
Brien




^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2003-07-31 15:22 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-28 15:29 sorting large numbers of large records Brien L. Christesen
2003-07-28 15:35 ` Vinzent Hoefler
2003-07-31 15:22   ` Brien L. Christesen
2003-07-28 16:25 ` Hyman Rosen
2003-07-28 20:30 ` John R. Strohm
2003-07-28 20:52   ` Hyman Rosen
2003-07-28 23:47     ` Matthew Heaney
2003-07-28 23:33 ` Matthew Heaney
2003-07-28 23:43 ` Matthew Heaney
2003-07-29  0:42 ` John Cupak
2003-07-29  3:38   ` Matthew Heaney
2003-07-29  8:32   ` Preben Randhol
  -- strict thread matches above, loose matches on Subject: below --
2003-07-29 13:10 Brien L. Christesen
2003-07-29 14:30 ` Larry Kilgallen
2003-07-30  0:32 ` Keith Thompson
2003-07-30  1:53   ` Hyman Rosen
2003-07-30 14:55     ` Matthew Heaney
2003-07-30 16:41       ` Chad R. Meiners

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox