Updated random.e ... 40-50 X speed increase overwriting
- Posted by Derek Brown <Tidefball at AOL.COM> Mar 17, 1999
- 400 views
(Even if you have no interest in random.e, this is an optimizer's tale with a happy ending). I rewrote the procedure that overwrites records, and acheived speeds of up to 50 times faster. The old algorithm would seek to the record past your desired record, then with a for/end for loop, it would append the remaining records with the get() command to a temporary variable. The data would then be transferred to another variable. After the overwrite record was written, it would then do another for loop and write each record over. Doh! What was I thinking? Now it just uses the gets() command to get it in one fell swoop (no loop), then use the puts() command to put it back in one iteration. I tried this before, but couldn't get it to work. I think I had other problems... so I abandoned the easy way and wrote the append algorithm. Benchmark times that were 20 seconds the old way are now down to less than half a second. Well, this will be the last new version for a while, probably for good. Derek