-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve tldraw example performance #640
Conversation
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #640 +/- ##
==========================================
- Coverage 88.63% 88.57% -0.06%
==========================================
Files 80 80
Lines 8894 8894
Branches 816 816
==========================================
- Hits 7883 7878 -5
- Misses 704 708 +4
- Partials 307 308 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution!
This was one of the highest-priority issues that Yorkie's tldraw example had.
It seems like this reduces PushPull()
API's data size by several times.
I have one thing to discuss with you.
How do you think of expanding this idea to only update the shape's changes (coordinate change, style change, size change, etc) by comparing the previous shape and the updated shape?
Thank you for your comment! Before PR, I considered about expanding this idea to only update the shape's changes. To compare difference of two object, I think it's better to use library(e.g., Lodash, deep-object-diff, ...) than implement detecting deep difference(because of complexity). And to emphasize yorkie-js-sdk's usage, I think it is appropriate not to use other libraries at most. If you think it's okay to use a library, I'll implement it. Or, is there any idea? |
@devleejb I think it will be okay to show usage of other libraries because this will show other developers that they can use this approach to optimize the size of document updates. How do you think of this idea, @chacha912? |
@krapie I wonder what you think about this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution.
I understand that this PR has made some changes to use CRDT to transmit data every time a shape is moved.
I have two questions:
Can Presence
be used in the tldraw example to represent the state that needs to be sent to peers who are still editing but have not completed their edits?
Additionally, is there a way to check how much improvement has been made?
@devleejb It seems like a good idea, but it may be out of scope. And like @hackerwins mentioned, it will be good to measure performance improvement. |
In previous tldraw example, the data is transmitted every time as same as my PR. But, in the example, when moving shapes, the unchanged data in shape object(e.g., color, point, ...) is transmitted and it made long latency. So, I send only changed data when moving shapes.
|
For sharing purposes, the information @devleejb left in the comment is also left here. |
@devleejb In this code, the Tldraw deletion element is not reflected in Yorkie. How about applying this code? Before:
After:
OR Deleted thing's shape is null when OnChangePage is working .
This can detect deleted elements on Tldraw Thank you!! |
@Jaeheon-Sim I added code for deleting shape. Thank for your help. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@devleejb The latency improvement will become larger as we move more shapes simultaneously. (When I measured latency improvement by moving 20 shapes by 1 pixel, latency improved 35ms
to 8ms
).
How do you think of expanding this idea to only update the shape's changes (coordinate change, style change, size change, etc) by comparing the previous shape and the updated shape?
After you implement this idea, please let me know.
I implemented your idea by comparing changed property in object. Thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for implementing this idea!
It will be good to test performance of this idea with previous ones.
Also, I left a small comment below.
I removed it. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution.
Looks good to me 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution.
What this PR does / why we need it?
In the tldraw example project, there's long latency when moving large shapes (e.g.,
DrawShape
).The reason is that the unchanged data (e.g., drawing points in
DrawShape
) is sent when moving shapes. So, in this PR, onlypoint
data (a point of shape on the whiteboard) is sent to the Yorkie server.Any background context you want to provide?
I was inspired by this solution.
codepair issue #194
What are the relevant tickets?
Fixes #
Checklist