4 ms·
There is a key difference. With the JSON version you are constantly serialising and parsing the entire file, even if you need to write just a single byte. With
by justsomeuser 5y ago
There is a key difference. With the JSON version you are constantly serialising and parsing the entire file, even if you need to write just a single byte.
With SQLite, you can read or write a few bytes without having to process the others.
Also, SQLite would allow observing the current state by querying the file, with the JSON version you would need to keep dumping the state every few seconds.
But I agree with you that most languages have solid support for JSON and it prevents you having to break down those tree structures into rows and then back again. For typed languages the struct becomes the schema.
SQLite indexes and joins also would not be a benefit if your state is small enough that queries are just filter functions with “full table scans”.
- anderspitman 5y ago> There is a key difference. With the JSON version you are constantly serialising and parsing the entire file Only serializing. The db is kept in memory, and only deserialized on startup. But why is this a problem at the scale I'm working with?
- justsomeuser 5y agoIt's no problem, just a different way of doing the same thing really.