FujiNetWIFI/fujinet-firmware

Improve CP/M file performance.

Aperta

#917 aperta il 24 apr 2025

 (0 commenti) (0 reazioni) (0 assegnatari)C (89 fork)auto 404
enhancementhelp wanted

Metriche repository

Star
 (284 stelle)
Metriche merge PR
 (Merge medio 11h 57m) (69 PR mergiate in 30 g)

Descrizione

File I/O is slow in CP/M.

This is because for each BIOS read sector:

  • The file is opened
  • The sector is read
  • The file is closed.

A similar pattern is done for the other methods I list below, it's very atomic, but very slow.

Calls to OpenFile() in lib/runcpm/disk.h call _sys_openfile(): https://github.com/FujiNetWIFI/fujinet-firmware/blob/master/lib/runcpm/abstraction_fujinet.h#L153 and read sequential: https://github.com/FujiNetWIFI/fujinet-firmware/blob/master/lib/runcpm/abstraction_fujinet.h#L223 and write sequential: https://github.com/FujiNetWIFI/fujinet-firmware/blob/master/lib/runcpm/abstraction_fujinet.h#L263 and read random: https://github.com/FujiNetWIFI/fujinet-firmware/blob/master/lib/runcpm/abstraction_fujinet.h#L293 and write random: https://github.com/FujiNetWIFI/fujinet-firmware/blob/master/lib/runcpm/abstraction_fujinet.h#L339

This needs to be extended to hold onto the file handle, and not open the file again if it has already been opened, thus avoiding the file_open call if needed, and finding out when to best close the file when it is no longer needed (so we don't leak file descriptors! A timer?)

-Thom

Guida contributor