Keep reference equality roundtripping maps and arrays through XPath#395
Draft
DrRataplan wants to merge 1 commit intomasterfrom
Draft
Keep reference equality roundtripping maps and arrays through XPath#395DrRataplan wants to merge 1 commit intomasterfrom
DrRataplan wants to merge 1 commit intomasterfrom
Conversation
This can improve performance because a map does not have to be copied a second time when returning from XPath. It also makes the APIs easier to use because an entry in the map will be exactly the same as the entry that was put in to engine as a variable. This makes FontoXPath more predictable
106b7f2 to
8516b44
Compare
Contributor
Author
|
This is a draft PR. I am aware naming is inconsistent. However, @JosVerburg @bwrrp, I think this PR can open up a lot of doors in fontoxpath-indices: more reference equality is usually more better. |
Member
|
That's a lot of code changes, I'll try to take a look in more detail later. Am I correct in assuming that the array / object will only retain reference equality as long as it has not been modified? Does that also apply to sub-values (e.g., a map stored in an array where the array is modified, but the map is not)? That could definitely be useful to prevent deep equality checks when using XQuery to manipulate such data! |
Contributor
Author
|
Correct! It will keep equality of maps in check as long as they have not been altered. As in, array:put accepts an array and a
sequence and returns a new array.
These changes will make sure that array is a new instance, but because of the recursive nature of XDM to JavaScript object transformation, any members *in* that array will be the same instances.
Same for maps.
|
Contributor
Author
|
Seems like some part of the compiler is very cross with me indeed. Might be some of the |
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 can improve performance because a map does not have to be copied a second time when returning
from XPath. It also makes the APIs easier to use because an entry in the map will be exactly the
same as the entry that was put in to engine as a variable.
This makes FontoXPath more predictable.
Relates to discussion #392