Skip to content

Suggestions for improvement #2

@gaberogan

Description

@gaberogan

From WinstonFassett:

I think you can save a lot of DynamoDB data loading and lambda cycles per ws message by avoiding calling getOrCreateDoc unless you really need it.
For example with messageAwareness messages, you can just broadcast and return early because they don't mutate the doc.
Even with messageSync messages, you may only really need to load the doc for writeSyncStep1.
That is to say, you might be able to skip loading the doc even for updates, because you are just doing a push and a broadcast
I see that you are calling Y.applyUpdate but it doesn't seem like that is necessary when just pushing an update to dynamo and rebroadcasting the original message
I think with those changes you would only ever have to actually read from DynamoDB and load the document and apply all known updates when clients send writeSyncStep1 after connecting

From dmonad:

Loading Yjs documents is the most expensive operation in y-websocket server. So my approach is to avoid loading the document by computing the differences directly on the binary update messages using the API I proposed here: yjs/yjs#263

It would be great if you could publish your work on https://discuss.yjs.dev/ if you want to make it available (using the "show" tag).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions