Handmade Hero»Forums»Code
Andy
13 posts
[Day 23] Recording in memory vs. to file
Hi there,

So I have a really old crappy hard drive that takes so long to read and write the game memory that it renders the looping useless. If I were to save the gamestate to memory instead of using a file is that likely to improve the feature on my machine? And also, I'm not exactly a whiz with C, I'm thinking I would have to do another Alloc to save the memory and load from the result of that alloc instead of reading from the file?
So I guess my real question is, Am I a raving lunatic, or is my thinking correct?
Thanks in advance for being so wonderful Handmade community!
Andy
13 posts
[Day 23] Recording in memory vs. to file
Actually I found a simple typo bug that was messing up the playback, so the playback works ok, but I counted 21 seconds to write the file. Can my hard-drive actually be that bad I wonder?
Mārtiņš Možeiko
2559 posts / 2 projects
[Day 23] Recording in memory vs. to file
Well yes, one option is to do what you suggest - write state to memory. That should help.

Another would be to simply reduce size of transient memory we allocate. Currently it is 1GB, but it is nowhere close we actually use. Just change it to something like 64MB and you will have 16x time faster save/load time. This will help until Casey will start to use much more of memory. But maybe by that time he'll implement caching mechanism much efficiently - like not saving stuff that can be regenerated (cached ground textures) or reloaded (sound effects or textures).

21 seconds means ~1GB/21sec = 48MB/s. That could be actual speed of older hdd (is it 5400rpm?)