Diffing#12
Merged
Merged
Conversation
Member
|
This is great! Also, I think we need a bench suite. |
Member
|
Also, please rename |
Contributor
Author
|
@Drup, |
Member
There was a problem hiding this comment.
I meant this equal, not the labels.
More straightforward implementation that does not use make_from (and thus fold)
Contributor
Author
|
Any further comments on this? It needs to get merged before the long-awaited Eliom release. |
Member
|
Let's merge, I'll try to come up with a good API later. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch implements a diffing algorithm. When a "set" operation is performed (either directly by the client, or via the implementation of
make_from_s) we diff the old data structure contents with the new contents, and export incremental patches.The diffing algorithm for lists is based on computing the longest common subsequence (based on standard recursion plus memoization). This is of quadratic complexity in the worst case, but I suspect our implementation performs decently in practice.
Most functions have gained an
?eqargument, which may be crucial for diffing; it depends on the contents. Note that diffing happens "early", e.g., if the input is a list of integers which is turned into a list of DOM nodes viamap, then we diff lists of integers. In this example, there is no need to pass~eq(the default(=)is just fine for integers). This early diffing means that we can avoid RPCs, DB queries, rebuilding DOM nodes and other complicated operations that happen downstream.As a side-effect, the mutable lists kept internally have been replaced by signals. I think the new implementation of
foldfixes #9.