Acme-CPANModules-OrderedHash
view release on metacpan or search on metacpan
NAME
Acme::CPANModules::OrderedHash - List of modules that provide ordered
hash data type
VERSION
This document describes version 0.004 of Acme::CPANModules::OrderedHash
(from Perl distribution Acme-CPANModules-OrderedHash), released on
2025-04-15.
SYNOPSIS
To run benchmark with default option:
% bencher --cpanmodules-module OrderedHash
To run module startup overhead benchmark:
% bencher --module-startup --cpanmodules-module OrderedHash
For more options (dump scenario, list/include/exclude/add participants,
list/include/exclude/add datasets, etc), see bencher or run "bencher
--help".
DESCRIPTION
When you ask a Perl's hash for the list of keys, the answer comes back
unordered. In fact, Perl explicitly randomizes the order of keys it
returns everytime. The random ordering is a (security) feature, not a
bug. However, sometimes you want to know the order of insertion. These
modules provide you with an ordered hash; most of them implement it by
recording the order of insertion of keys in an additional array.
Other related modules:
Tie::SortHash - will automatically sort keys when you call keys(),
values(), each(). But this module does not maintain insertion order.
ACME::CPANMODULES ENTRIES
Tie::IxHash
Hash::Ordered
Tie::Hash::Indexed
Provides two interfaces: tied hash and OO.
Tie::LLHash
Tie::StoredOrderHash
Array::OrdHash
Provide something closest to PHP's associative array, where you can
refer elements by key or by numeric index, and insertion order is
remembered.
List::Unique::DeterministicOrder
Provide a list, not hash.
Tree::RB::XS
Multi-purpose tree data structure which can record insertion order
and act as an ordered hash. Use "track_recent => 1,
keys_in_recent_order => 1" options. Can be used as a tied hash, or
as an object (faster).
BENCHMARKED MODULES
Version numbers shown below are the versions used when running the
sample benchmark.
Tie::IxHash 1.23
Hash::Ordered 0.014
Tie::Hash::Indexed 0.08
Tie::LLHash 1.004
Tie::StoredOrderHash 0.22
Array::OrdHash 1.03
Tree::RB::XS 0.19
BENCHMARK PARTICIPANTS
* Tie::IxHash (perl_code)
Tie::IxHash
* Hash::Ordered (perl_code)
Hash::Ordered
* Tie::Hash::Indexed (perl_code)
( run in 0.640 second using v1.01-cache-2.11-cpan-39bf76dae61 )