Storing crash relevant information

Sometimes it’s helpful to store debug information on a regular basis somewhere and recover it if the program is crashed and restarted to get info about the cause of the crash. Unfortunately, there’s no perfect way for storing this data in Windows. And you don’t want to slow down your program to much. So I tried a benchmark and compared¬†RegSetValueEx against SetFilePos(0) + WriteFile. (In both cases the handle was opened just once then used for writing¬†100.000 times.

And it turned out that WriteFile is 10x faster. More interesting facts:

– FILE_ATTRIBUTE_TEMPORARY didn’t change a thing.

– My SSD is fast (298ms), but my hard disk is faster (268ms, don’t ask me why) and my Ramdisk faster than both (206ms).

Comments are closed.