develooper Front page | perl.perl5.porters | Postings from May 2013

Should we make hashes return keys in FIFO order?

Thread Next
From:
demerphq
Date:
May 10, 2013 07:52
Subject:
Should we make hashes return keys in FIFO order?
Message ID:
CANgJU+UxvhStFo_fn=-gYv7A=mnQ-AAFzuAGqSK+EQ-qZb-rpA@mail.gmail.com
Various languages make their hashes return items inserted into them in
first in first out order. I was wondering if we should do the same.

The principle disadvantage is a memory penalty per key.

The advantages are varied, and range from usefully predictable
semantics regardless of underlying hash function, which has positive
security implications, and would make keys(), values() and each()
faster. It would also make insertion into a hash during traversal
safe.

I think I will try to do an implementation so it can be benchmarked
and compared to the existing code so we can compare numbers. Because
we support lazy deletes, I think we can get away with a single
additional pointer per HE.

Thoughts?

cheers
Yves
--
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About