My app has a settings file. It can get pretty big (a few MB) because it also contains some history data in it.
When you do something in the app, it auto-saves. But this causes a big pause, because it takes so long to rewrite the file. I tried using async file saving, but if you close the app while it's saving, you lose all the data.
How can I safely autosave settings without lag?
My best idea is to use a local database, but then a user can't simply edit the settings file anymore (currently it's a simple json file, I don't want it to be more complicated to copy all your settings to a new computer for example)