4 ms·
Don’t worry, most current message apps have code that horrible. Be it matrix simply writing a HashMap into a file as "database" replacement https://github.com/
by kuschku 9y ago
Don’t worry, most current message apps have code that horrible.
Be it matrix simply writing a HashMap into a file as "database" replacement https://github.com/matrix-org/matrix-android-sdk/blob/master/matrix-sdk/src/main/java/org/matrix/androidsdk/data/store/MXFileStore.java#L2251 https://github.com/matrix-org/matrix-android-sdk/blob/master...
Or Signal simply taking apart Android system structs with JNI, to get a file descriptor’s owner https://github.com/signalapp/Signal-Android/blob/master/jni/utils/org_thoughtcrime_securesms_util_FileUtils.cpp https://github.com/signalapp/Signal-Android/blob/master/jni/...
There’s lots of suboptimal code in messaging apps. All of them.
- slowmotiony 9y agoWhy do you need a database over a serialized object like a hashmap file if there is only one user and one device?
- kuschku 9y agoBecause writing the entire dataset back out on every addition or removal is extremely wasteful. The existing database implementations in the system do much less writes. Doing such large, constant writes not only is slower, it also degrades the NAND.
- slowmotiony 9y agoThank you