pythonperformancehard-drivesolid-state-drive

Does 100x writing 1 letter to a text file significantly wear down a hard drive / ssd more, than writing 1x 100 letters at once?


Basically I'm writing hundreds of times per minute to a log file, I wonder if it makes a significant difference to the longevity of a hdd / ssd whether I write every change directly to the log file, or if I should just temporarily save the changes in ram and dump them once a minute to the log?

Not sure if relevant, but I'm using python's:

with open('log.txt', 'a') as log: log.write('a') command


Solution

  • It shouldn't make any significant difference. Python uses buffered output when writing the file, and the OS has file buffers in the kernel.