I've just added looped live code editing to my source. It is functional, but has the following issue:
When I hit 'L' to start recording, the program consistently hangs for 10 full seconds before proceeding (I know this because I can hear the sound buffer loop 10 times). This consistency makes me wonder whether it's an issue with how I'm accessing the file, rather than the performance of my machine.
I've confirmed that the culprit is the call to WriteFile:
| WriteFile(Win32State->InputRecordHandle, Win32State->GameMemoryBlock, BytesToWrite, &BytesWritten, 0);
|
Adding a watch to BytesWritten shows that this call is writing 1,140,850,688 bytes (which is correct for 1 GB permanent storage plus 64 MB transient storage).
I understand that this is a synchronous file access and we should expect a fairly high wait time, but 10 seconds? Consistently? It takes a lot less time for Casey on the stream.
Prior to the GameState write to file, I use the following call to create the file and point the handle to it:
| Win32State->InputRecordHandle = CreateFile(PathName, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0);
|
Many thanks in advance for your thoughts.