The Perl Toolchain Summit 2025 Needs You: You can help 🙏 Learn more

NAME

Shannon::Entropy::XS - Calculate the Shannon entropy H of a given input string faster.

VERSION

Version 1.11

SYNOPSIS

Calculate the Shannon entropy H of a given input string.

use Shannon::Entropy::XS qw/entropy/;
entropy('1223334444'); # 1.8464393446710154
entropy('0123456789abcdef'); # 4

entropy

BENCHMARK

use Benchmark qw(:all);
timethese(10000000, {
'Entropy' => sub {
my $string = 'thisusedtobeanemail@gmail.com';
Shannon::Entropy::entropy($string);
},
'XS' => sub {
my $string = 'thisusedtobeanemail@gmail.com';
Shannon::Entropy::XS::entropy($string);
}
});

...

Benchmark: timing 10000000 iterations of Mask, XS...
Entropy: 35 wallclock secs (35.81 usr + 0.01 sys = 35.82 CPU) @ 279173.65/s (n=10000000)
XS: 2 wallclock secs ( 1.60 usr + 0.08 sys = 1.68 CPU) @ 5952380.95/s (n=10000000)

AUTHOR

LNATION, <email at lnation.org>

BUGS

Please report any bugs or feature requests to bug-shannon-entropy-xs at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Shannon-Entropy-XS. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

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

perldoc Shannon::Entropy::XS

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2024 by LNATION.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)