>600x speedup is hard to crack - my best examples hover between 70 and 250...
>completing the package in less than twice the time the original runs is also a good measure
I had once reworked a parser to about 20x - didn't measure the speedup at all, as it was getting different files and the format kept changing, but, just for comparison:
- the original code read the text file using fread(), one byte at a time
- it did a lot of fseek() back and forth, frequently going one byte back, in an attempt to decide the delimiters.
- about 20 lines of code and a few more fseek()s were there just to determine end of line
Just rewriting this to fread() about 16k of text at a time, chop the text into lines and then use a few strtran()s to distinguish between comma-as-delimiter from comma-inside-text brought about 10x speedup.
Then it got interesting - the specs changed, and the incoming files didn't have a fixed structure anymore. Some columns may or may not be present, but if they were, there would have to be some code (for many of them) which would convert them (several of those contained something xml-like, i.e. multiple values in a special format). The routine had lots of "if column exists, thiscall() endif". So I wrote a little code generator, which would check for existence of each field, and include a line or two in the generated prg for each that was there, and omitted the absent. By my guesstimate, it saved about 40000 if-endif blocks on each run, just on columns which didn't occur regularly.