« Return to Thread: Ann: SWI-Prolog 5.6.54

Re: Ann: SWI-Prolog 5.6.54

by Tom Schrijvers-2 :: Rate this Message:

Reply to Author | View in Thread

> P.s. Tom, you can of course get the old behaviour using
>
> hash(Term, Hash) :-
> (   integer(Term)
> ->  Hash = Term
> ;   hash_term(Term, Hash)
> ).
>
> I think the new implementation is better as it guarantees proper
> distribution when hashing integers that have some pattern.

Good point. I should do some measurements to see which is faster on
average. Hashing is a bottleneck in CHR. Exploiting the property that
integers hash to themselves made a big difference.

I expect the new hash_term/2 implementation is slower than before?

> P.s. I think hash_term/2 should be called term_hash/2.  Cf. term_variables
> and argument order.  I'm a bit reluctant to change it though.

Yes, that does make more sense.

Tom

--
Tom Schrijvers

Department of Computer Science
K.U. Leuven
Celestijnenlaan 200A
B-3001 Heverlee
Belgium

tel: +32 16 327544
e-mail: tom.schrijvers@...
url: http://www.cs.kuleuven.be/~toms/

------------
For further info, please visit http://www.swi-prolog.org/

To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
in its body to majordomo@...

 « Return to Thread: Ann: SWI-Prolog 5.6.54