Filip Konvička wrote:
I wanted to measure the performance of the comparison operator Value.'==', and I do not understand the results I get.
(...)
Results:
T1==T2 finished in 687 ms
T1==T2 (2) finished in 688 ms
T1==T3 finished in 78 ms

TEST1 and TEST2 perform equally, even though T1 is unified with T2 before TEST2. Shouldn't TEST2 be as fast as TEST3?

Unification does not merge data structures in memory! It only performs variable bindings to make both values isomorphic. Therefore T1=T2 has no effect on memory, it only checks equality. T3=T1 is different: it binds T3 to the record T1, making T1 and T3 identical references.

You can observe the difference with System.eq, which returns true if both arguments are identical references. {System.eq T1 T2} returns false, while {System.eq T1 T3} returns true.

Cheers,
raph

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to