NAME
TipJar::sparse::array::perl::hashbased - reference implementation of sparse array
SYNOPSIS
use TipJar::sparse::array::perl::hashbased;
sparse my @S;
...
DESCRIPTION
An implementation of a sparse array tie class based on a Perl hash. This module is intended as a reference implementation for testing, and other modules providing the same semantics but better performance may be forthcoming later.
This module efficiently provdes correct delete
behavior, which is to adjust the size of the array down to the last existing element when the top element is deleted, by maintaining a sorted array of existing keys.
the splice
handler could be improved. Currently it avoids specifically handling all the possibilities by always renumbering existing elements from the splice point up, then rebuilds the sorted list of existing elements.
keys are kept relative to an adjusting offset to support fast shift
/unshift
operations.
EXPORT
The sparse
function is sugar to tie its array argument into this class.
SEE ALSO
AUTHOR
David Nicol
COPYRIGHT AND LICENSE
Copyright (C) 2011 by David Nicol / TipJar LLC
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.