Open baileytincher opened 3 years ago
@jtaylorchang since this will be heavily used, you may have concerns on performance. Any suggestions on data structures/libraries? We effectively need a non-nested dictionary. Can use an object but that may be slow? Also not sure how to deal with modifying objects when considering async actions.
In-memory DB libraries I've found on npm are ~3mb which I'm guessing is too big.
Well since this is a global variable anyways with a single instance that isn't watched by renders, you can simply use a regular object and mutate it (rather than creating a new one or using an immutable). Immutability only matters for efficient component rendering. 3mb package is definitely too big since our bundle size is already getting large and 3mb is massive. (Also I think a database is overkill). Also I don't think you need to worry about race conditions when mutating the object anyways since it's single threaded
When the socket client sends events such as
edit_cell
, it expects an acknowledgment from the server in the form of acell_edited
broadcasted message. Reasonably, this should happen in a short window of time (~few secs or less).