| JerryMouse 2004-06-25, 6:50 pm |
| Robert Wagner wrote:
> This is a re=posting of the sorts demo with one added test: inserting
> records into an indexed file and reading them back in sequence. Jerry
> Mouse said this technique is "efficient". In FACT, it ran 15 times
> slower than a Cobol sort and more than 100 times slower than a fast
> sort.
No, I said using ISAM to add a row to a table was "better" than coding
row-insertion manually (which does involve some ordering methodology).
Nevertheless, let's see: using your numbers:
ISAM sort technique = 6 sec for 50,000 records, 10 COBOL statements.
Imbedded SORT verb technique = 0.4 seconds, six COBOL statements.
Radix-Linked list technique = .04 seconds, ~106 COBOL statements (harder to
count because of the thousands of comments necessary to explain what's going
on vs. no comments for the self-documenting ISAM or SORT code).
Obviously, it takes 200 times longer to code a radix sort and debug it than
it takes a programmer to dash off ten lines of ISAM code (or six lines of
SORT code).
If the application is sorting 5 million records every hour (maybe credit
card transactions?), the effort invested in an advanced sort technique may
be appropriate (40 vs. 4 seconds). If, on the other hand, the application is
sorting 2,000 accounts payable records once a month, you'll never recoup the
investment in an advanced sort. Never.*
The examples are interesting as an intellectual exercise - similar to
fooling with the TV Guide crossword puzzle while waiting for the dentist. It
is sufficient to know these techniques are available for the
once-in-a-decade instance where they would be indicated.
---
* Let's see: At ten lines of debugged code per day, a "quick and dirty" sort
= 1 day of programmer time. A "sooper-dooper" sort = 10 days = 9 days
difference. At, oh, $200/day, that's $1800 to regain over the life of the
program (not counting lost opportunity costs).
The super-sort runs - in the AP example - 1/2 second faster per month, six
seconds per year (mumble, mumble, carry the two...).
My brain hurts. Looks like the AP program with the Shazzam Double-Clutched
Sort will pay for its extra development expense somewhere near the
heat-death of the sun.
|