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)
% perl -MAcme::CPANModules::OrderedHash -E'say $_->{module} for @{ $Acme::CPANModules::OrderedHash::LIST->{entries} }' | cpanm -n
This Acme::CPANModules module contains benchmark instructions. You can
run a benchmark for some/all the modules listed in this
Acme::CPANModules module using the bencher CLI (from Bencher
distribution):
% bencher --cpanmodules-module OrderedHash
This Acme::CPANModules module also helps lcpan produce a more meaningful
result for "lcpan related-mods" command when it comes to finding related
modules for the modules listed in this Acme::CPANModules module. See
App::lcpan::Cmd::related_mods for more details on how "related modules"
are found.
HOMEPAGE
Please visit the project's homepage at
<https://metacpan.org/release/Acme-CPANModules-OrderedHash>.
SOURCE
Source repository is at
<https://github.com/perlancar/perl-Acme-CPANModules-OrderedHash>.
SEE ALSO
Acme::CPANModules::HashUtilities
Acme::CPANModules - about the Acme::CPANModules namespace
cpanmodules - CLI tool to let you browse/view the lists
AUTHOR
perlancar <perlancar@cpan.org>
CONTRIBUTOR
Michael Conrad <mike@nrdvana.net>
CONTRIBUTING
To contribute, you can send patches by email/via RT, or send pull
requests on GitHub.
Most of the time, you don't need to build the distribution yourself. You
can simply modify the code, then test via:
% prove -l
If you want to build the distribution (e.g. to try to install it locally
on your system), you can install Dist::Zilla,
Dist::Zilla::PluginBundle::Author::PERLANCAR,
Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two
other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps
required beyond that are considered a bug and can be reported to me.
COPYRIGHT AND LICENSE
This software is copyright (c) 2025 by perlancar <perlancar@cpan.org>.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
BUGS
Please report any bugs or feature requests on the bugtracker website
<https://rt.cpan.org/Public/Dist/Display.html?Name=Acme-CPANModules-Orde
redHash>
When submitting a bug or request, please include a test-file or a patch
to an existing test-file that illustrates the bug or desired feature.
( run in 1.401 second using v1.01-cache-2.11-cpan-39bf76dae61 )