-
-
Notifications
You must be signed in to change notification settings - Fork 394
[LiveComponent] Fix calculateFingerprint with big objects #725
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
[LiveComponent] Fix calculateFingerprint with big objects #725
Conversation
|
I'm having the same issue. |
kbond
left a comment
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.
Makes sense to me!
|
Great catch on this! These fingerprints need to be a deterministic string that represents "the input passed into a component" -
If you pass an object (e.g. a I'm open to ideas on how to fix this. In practice, if we added some special code for entity objects that, if persisted, used their id instead of serializing them, that might solve things. For example, if one of the items in |
Oops, didn't realize this. Could |
|
I think |
|
You're right. From php.net:
|
We should have a test to prove this behaviour. |
|
Perhaps it's an idea to add |
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.
This is probably the best solution.
@LunkLoafGrumble does this method improve the speed in your app?
Could you add a basic integration test for FingerprintCalculator that proves the generated fingerprint is the same two different object instances that are equal?
|
Using objectNormalizer greatly improves the performance over just serializing the object. |
kbond
left a comment
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.
A few remaining minor things, then good to go by me!
src/LiveComponent/tests/Integration/Util/FingerprintCalculatorTest.php
Outdated
Show resolved
Hide resolved
src/LiveComponent/tests/Integration/Util/FingerprintCalculatorTest.php
Outdated
Show resolved
Hide resolved
src/LiveComponent/tests/Integration/Util/FingerprintCalculatorTest.php
Outdated
Show resolved
Hide resolved
|
Let's give this version a try - thanks @LunkLoafGrumble! |
|
FYI - I'm reverting this in #832. But I'm hoping that it's not a problem anymore because usually zero LiveProps are used to calculate the fingerprint. But please tell me if you still have issues. |
…alculator (weaverryan) This PR was merged into the 2.x branch. Discussion ---------- [Live] Reverting back to simpler serialize for fingerprint calculator | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Tickets | Fix #831 | License | MIT This reverts #725. The problem is that using the serializer opens all kinds of cans of worms, including circular reference problems. So, do we still have the big performance problem of #725? I'm not sure. We now only calculate the fingerprint based on LiveProps with `updateFromParent`. Commits ------- 18fb8a0 [Live] Reverting back to simpler serialize for fingerprint calculator
This pull request will fix an issue for large objects (for example entities with a large relations) with in the FingerprintCalculator
While working with liveComponents I noticed my project getting slower and slower. After some digging I found out that in the calculateFingerprint function the data is serialized. When an entity with relations passes by it will serialize the entity and its child objects. This takes a considerable amount of time and is not needed.