This is a very fast comparison of two values which only checks if the pointers are equal.

The intended way of using the function is to speed up comparisons.

If you know that all occurances of REC(1.5) are the same pointer (e.g. if you made a pass on your datastructure that replaced all occurances with a single one), you can use referenceEq instead of structural equality (valueEq or a user-provided comparison).

You can also use the function to speed up comparsions if the rate of success is expected to be high or the cost of structural equality is high. But then you need to do a structural equality check after to make sure nothing is wrong.

You can use the function to avoid reconstructing an identical datastructure on traversals, which saves memory and time spent on garbage collection: case rec as REC(x) equation nx = f(x); then if referenceEq(x,nx) then rec else REC(nx);


function referenceEq<A>
  input A a1;
  input A a2;
  output Boolean b;
end referenceEq;

Generated at 2021-06-12T00:32:04Z by OpenModelicaOpenModelica 1.18.0~dev-320-g1a21771 using GenerateDoc.mos