I'm creating a component (C++) which intends to simulate non-volatile RAM (32k) by writing information to a file on disk (data is flushed to disk after each write operation).
I notice that each write to this NVRAM takes about (max.) 94ms. However the application which uses this component frequently writes to the NVRAM (f.e. after scanning an article it writes 10 settings to NVRAM by calling 10 times the write-method of the component). So for each action by the application, I notice an extra delay of approx. 1s (or more) which is intolerable for the application.
Could you provide me some advice on increasing the performance when using writing to a file?
Current way of working in write method of component :
* read content of file
* write new content to file
* flush data to disk (takes most of the time)
Is multithreading an option and why?
BTW. Using other hardware (harddisk) is no option.
BTW. The application may not be changed.