4 ms·
Can you say more? How did it give huge boosts to speed?
by neonate 8y ago
Can you say more? How did it give huge boosts to speed?
- WalterBright 8y agoA typical buffer size for DOS was 512 bytes, the size of a floppy disk sector. I used 20K. Writing bigger chunks at a time enabled the operating system to optimize it for better throughput to the disk driver. (Fewer seeks, for example.) Fewer round trips to the operating system almost always speeds things up, too, especially if it involves a context switch. Things got even better when the switch to hard disks was underway. Hard disks had bigger sector sizes, but the buffer size sometimes remained at 512. This meant the driver had to read the sector, fold in the 512, then write it back out. Oops! Later on, demand paged virtual memory and memory caching also favored big buffers.
- sillysaurus3 8y agoIt's interesting how similar that is to the type of optimizations gamedevs do today. E.g. sub out "floppy disk sector" for GPU memory and crank up the numbers a few orders of magnitude.
- masklinn 8y agoIt's not just gamedevs. I/O buffering remains an important source of both performances and frustrations (when the I/O is buffered a bit too heavily and nothing appears in the output because in-memory buffers are still filling), and most modern languages provide buffering wrappers or even buffer file I/O by default.
- caf 8y agoHard disk sectors were 512 bytes and remained that way up until about 2010. ITYM the FAT cluster size?
- WalterBright 8y agoIf I recall correctly, disks emulated 512 byte sectors for compatibility, but actually had larger ones. But I don't have documentation on such pre-google things :-)
- baruch 8y agoDisk sectors remained 512 for a very long time, only in recent years (2010 sounds right) did they make the 4k sectors with emulation for 512 or just native 4k drives. It is true however that sequential access to hdds and floppies was always much faster than random access or even sequential in small buffers simply because the drive does not need to wait for the platter rotation to reach the right location again for each sector written but rather just write them all in one go.
- wruza 8y agoFloppy track seeking is such a pain to wait, so smartdrv.exe never left my autoexec.bat once discovered. I don’t understand how that wasn’t a default for latest DOSes.