cybersemics / em

A beautiful, minimalistic note-taking app for personal sensemaking.
Other
258 stars 88 forks source link

RxDB optimizations #2075

Open raineorshine opened 1 week ago

raineorshine commented 1 week ago
    1. We can improve the updateThought function by doing rx operations in parallel -> putting each rx operation into an array, and then doing Promise.all.
    1. The deleteLexeme function could do a bulk remove operation as we have it on the deleteThoughts function -> as a rule, doing bulk operations is faster.
    1. useObserveCol hook would be faster if we return the rx docs directly instead of mapping them and then converting them with .toJSON.
  • 3.1. Of course, this change will affect the types in the Devices component, we should update this component as well to adapt to the RxPermissionDocument type.
    1. RxDB will automatically handle the memory cache, so we don't need to worry about it.
  • 4.1. For the freeThought and freeLexeme functions, there's nothing to do right now in terms of memory handling. We should check them again when we have implemented the replication to a server with real-time functionality.
    1. In general, using the RxDB documents in the whole app would be better/faster, instead of, getting the "raw" data of each document with .toJSON and then casting it to the corresponding type in the app.