Compare with "is distinct" in array_distinct, array_intersect#559
Compare with "is distinct" in array_distinct, array_intersect#559findepi merged 1 commit intotrinodb:masterfrom
Conversation
There was a problem hiding this comment.
We may want to add a test with repeated entries in one (or both) of the arrays.
There was a problem hiding this comment.
This is not a good pattern, as it will be a megamorphic callsite. What we generally want to do is assemble a methodhandle via methodhandle combinators. The VM is pretty good at generating specialized call trees without profile pollution for those. It's probably not trivial to do for the code that uses this (the array_intersect function + TypedSet combo), so, at a minimum, I'd prefer for this to be done directly in typed set to discourage (or at least not encourage) unwitting developers from reusing this method in other places.
Also, this function is weird. It's not clear why a function that computes whether two elements are distinct from each other needs a function that computes whether the elements are distinct from each other. :)
There was a problem hiding this comment.
Adding methodHandle dependencies in the methods that get called row per row is a bit of an anti-pattern. It typically means the code is turning around and doing methodHandle.invoke at some point, which become polymorphic when the function is used in a variety of contexts. A better approach is to get the dependencies during the "get implementation" call, which should assemble a methodhandle chain or generate specialized bytecode.
It doesn't matter for this specific instance since it's hard to assemble the methodhandle chain with the TypedSet in the middle, but I'm just pointing it out as a general comment (so no need to change anything here).
e1d421f to
89ffab7
Compare
d2c2416 to
c4d90ca
Compare
Addresses #560 for
array_distinct,array_intersect.