$start = time; my $stream = Data::BitStream::XS->new; # $stream->write(32, $n) for 1 .. $ITERS; # Below is faster $stream->put_raw(pack("N",$n) x $ITERS, 32*$ITERS); $stream->rewind_for_read; for (1 .. $ITERS ) { stuff($stream->read(14), $stream->read(6), $stream->read(6), $stream->read(6)); } printf " D::B::XS took: %.12f seconds\n", ( time() - $start ) / $ITERS; $start = time; for (1 .. $ITERS ) { my $vector = Bit::Vector->new_Dec(32, $n); stuff($vector->Chunk_Read(14, 18), $vector->Chunk_Read( 6, 12), $vector->Chunk_Read( 6, 6), $vector->Chunk_Read( 6, 0) ); } printf "Bit::Vector took: %.12f seconds\n", ( time() - $start ) / $ITERS; $start = time; my $vector = Bit::Vector->new(32*$ITERS); $vector->Word_List_Store(($n) x $ITERS); for (0 .. $ITERS-1 ) { stuff($vector->Chunk_Read(14, 32*$_+18), $vector->Chunk_Read( 6, 32*$_+12), $vector->Chunk_Read( 6, 32*$_+6), $vector->Chunk_Read( 6, 32*$_+0) ); } printf "Bit::Vector took: %.12f seconds\n", ( time() - $start ) / $ITERS;