Tag - speed

great performance increases

great performance increases

Today I’ve worked on optimizing the performance of the AFP reader
and have made great strides.

My original track times were nearly 475ms. This was 300ms reading the actual disk, 125ms transferring, and process times of around 50ms. This put the total disk time, not including overhead of saving the ADF which adds a half a dozen seconds, to about 76s. That’s a 1:16. Not horrible, but not great.

I’ve done a couple things:

  • Reduced the number of bytes read off the disk from 15232 (14 tracks) to 14055(11 tracks + one byte short of a full sector (worst case) 1087 + 1000 byte gap(slightly bigger than I need)
  • This in turn reduced the time needed to actual read the disk, from a “forced-wait”(ie my code used to just do a Thread.sleep() pause, from 300ms to 220ms (actual disk time, now)
  • Less data read means less transferred, and this moved my transferred bytes from ~15238 to ~11,977. Smaller transfer is now between 94ms-110ms depending on USB scheduling.

SO this means that I’m now running actual times of about 370ms total. This is 220ms (diskread) + 102ms (average usb xfer time) + ~50ms PC processing time. A 370ms track read translates to 59.2 seconds full disk read!!

With the overhead of the floppy disk drive warming up, and saving the final ADF to the HD, this translates to an actual time of approximately 65 seconds.

My target speed for this has always been 1 minute per disk(Jan 07 post).

While there are at least a few other ways to optimize, most of them either make the code too complex, or do things in such a non-standard way that implementing them would just make maintaining and growing this code harder in the future.

The bulk of the time right now is made up by the untouchable base of 220ms. This time will never be reduced, and makes up about 60% of time I’m spending. On certain fast reads, it makes up nearly 67% of the time I’m seeing. So between 3/5 and 2/3 of the time can’t be touched.

I’m happy with this performance and won’t be addressing it again for some time. I have to move on to improving the user interface, fixing the terminal mode so it works again(after jd2xx change), reporting with and dealing with errors within the user interface (instead of standard output, where everything goes right now), and adding some odds and ends.