Doubly

 view release on metacpan or  search on metacpan

lib/Doubly/Pointer.pm  view on Meta::CPAN

Remove the first item from the list.

	$list->remove_from_start();

=head2 remove_from_end

Remove the last item from the list.

	$list->remove_from_end();

=head2 remove_from_pos

Remove an item by index from the list.

	$lst->remove_from_pos($index);

=head2 find

Itterate the list from the start until a match is found for the cb.

	$list = $list->find(sub { (ref $_[0] || "") eq 'HASH' && $_[0]->{a} == 1 ? 1 : 0 });


=head1 BENCHMARKS

	my $r = timethese(100000, {
		'Doubly::Linked' => sub {
			my $linked = Doubly::Linked->new(123);
			$linked->bulk_add(0..1000);
			$linked = $linked->end;
			$linked->is_end;
			$linked = $linked->start;
			$linked->is_start;
			$linked->add(789);
		},
		'Doubly::Linked::PP' => sub {
			my $linked = Doubly::Linked::PP->new(123);
			$linked->bulk_add(0..1000);
			$linked = $linked->end;
			$linked->is_end;
			$linked = $linked->start;
			$linked->is_start;
			$linked->add(789);
			$linked->destroy;
		},
		'Doubly::Pointer' => sub {
			my $linked = Doubly::Pointer->new(123);
			$linked->bulk_add(0..1000);
			$linked = $linked->end;
			$linked->is_end;
			$linked = $linked->start;
			$linked->is_start;
			$linked->add(789);
		}

	});

	cmpthese $r;


	Benchmark: timing 100000 iterations of Doubly, Doubly::Linked, Doubly::Linked::PP...
	    Doubly: 2.70105 wallclock secs ( 2.43 usr +  0.23 sys =  2.66 CPU) @ 37593.98/s (n=100000)
	Doubly::Linked: 25.6334 wallclock secs (23.54 usr +  1.88 sys = 25.42 CPU) @ 3933.91/s (n=100000)
	Doubly::Linked::PP: 190.169 wallclock secs (189.59 usr +  0.19 sys = 189.78 CPU) @ 526.93/s (n=100000)
			      Rate Doubly::Linked::PP   Doubly::Linked            Doubly
	Doubly::Linked::PP   527/s                 --             -87%              -99%
	Doubly::Linked      3934/s               647%               --              -90%
	Doubly             37594/s              7035%             856%                --


=head1 AUTHOR

LNATION, C<< <email at lnation.org> >>

=head1 BUGS

Please report any bugs or feature requests to C<bug-doubly at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Doubly>.  I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.


=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Doubly::Pointer


You can also look for information at:

=over 4

=item * RT: CPAN's request tracker (report bugs here)

L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Doubly>

=item * CPAN Ratings

L<https://cpanratings.perl.org/d/Doubly>

=item * Search CPAN

L<https://metacpan.org/release/Doubly>

=back


=head1 ACKNOWLEDGEMENTS


=head1 LICENSE AND COPYRIGHT

This software is Copyright (c) 2025 by LNATION.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)

=cut

1; # End of Doubly::Pointer



( run in 0.774 second using v1.01-cache-2.11-cpan-71847e10f99 )