>>Looking back on it now, those 5 minutes paid my salary for the entire year.
>>
>
>It's great to be able to recall those insights, isn't it? For me, they make this profession sizzle.
One of such moments was on my first US job. They had a flat, text table that resided in another app, written IIRC in Delphi, with the whole hospital departments hierarchy, down to the laundry. It would then get imported into a dbf, which was then recursively selected from to build the tree. Which took quite long, that's a hundred selects (including those that returned nothing because you're on a leaf node), and happened each time you opened a form which may need it.
I jumped in after „imported into a dbf“, which I made into a local cursor, and added a hierarchical key in it, then went through recursive scans to build that key for each record, and then indexed by it. The speed gain was twenty times.
The last one, on the same job, was an import from a text file. The initial version was reading it byte by byte, like an elementary parser, sometimes even doing a fseek() backwards (!). Obviously whoever wrote it knew nothing of aLines(), let alone its parameters. The last version had to be special, because the assortment of columns in the incoming csv varied, so to avoid checking for each column for each row, I had a type object which would handle each column, and included objects for each present column - so checking for them only once, at the header row. By my calculation, it saved me about 40000 IFs per run, on the average.