Build.PL100644000765000024 324113123001251 16314 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24# ========================================================================= # THIS FILE IS AUTOMATICALLY GENERATED BY MINILLA. # DO NOT EDIT DIRECTLY. # ========================================================================= use 5.008_001; use strict; use warnings; use utf8; BEGIN { push @INC, '.' } use builder::MyBuilder; use File::Basename; use File::Spec; my %args = ( license => 'perl_5', dynamic_config => 0, configure_requires => { 'Module::Build' => '0.4005', }, requires => { 'Carp' => '0', 'Digest::MurmurHash3::PurePerl' => '0.02', 'XSLoader' => '0', 'perl' => '5.008008', }, recommends => { }, suggests => { }, build_requires => { 'File::Temp' => '0', 'Test::Fatal' => '0.008', 'Test::More' => '0.98', }, test_requires => { }, name => 'Algorithm-HyperLogLog', module_name => 'Algorithm::HyperLogLog', allow_pureperl => 0, script_files => [glob('script/*'), glob('bin/*')], c_source => [qw()], PL_files => {}, test_files => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt') ? 't/ xt/' : 't/', recursive_test_files => 1, ); if (-d 'share') { $args{share_dir} = 'share'; } my $builder = builder::MyBuilder->subclass( class => 'MyBuilder', code => q{ sub ACTION_distmeta { die "Do not run distmeta. Install Minilla and `minil install` instead.\n"; } sub ACTION_installdeps { die "Do not run installdeps. Run `cpanm --installdeps .` instead.\n"; } } )->new(%args); $builder->create_build_script(); Changes100644000765000024 276413123001251 16324 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24Revision history for Algorithm::HyperLogLog 0.24 2017-06-22T17:47:05Z - Update Build.PL for perl-5.26 0.23 2014-05-12T16:58:51Z - Add new method 'Algorithm::HyperLogLog::merge()' (dgryski) 0.22 2013-06-25T22:54:20Z - Fixed broken test 0.21 2013-06-25T17:42:09Z - Fixed '--pureperl-only' option support 0.20 2013-06-23T09:09:42Z - Change dependency - Switch aurhoring tool to Minilla 0.19 Mon Jun 17 22:30:00 2013 - Change MurmurHash3 implementation for PP 0.18 Sun Jun 16 23:50:00 2013 - Update dependency - Change document format 0.17 Fri Jun 14 02:02:00 2013 - Fixed warning in perl-5.18 0.16 Sat May 11 16:05:00 2013 - Fixed broken test 0.15 Sat May 11 15:47:00 2013 - Support multi arguments for add() - Support '--pureperl-only' option for Build.PL 0.14 Sat Apr 14 03:30:00 2013 - Change required perl version - Add $VERSION to Algorithm/HyperLogLog/PP.pm 0.11 Fri Apr 05 01:40:00 2013 - XSLoader is loaded when runtime 0.10 Wed Apr 03 22:15:00 2013 - [enhancement] register dump/restore feature - [bugfix] hash calculation error in big endian environment 0.05 Wed Mar 27 23:30:00 2013 - Fixed: integer overflow in 32bit environment 0.04 Sat Mar 23 01:50:00 2013 - Fixed: unportable tests 0.03 Thu Mar 21 03:15:00 2013 - Remove unnecessary code in XS 0.02 Wed Mar 20 16:10:00 2013 - Improve Windows(MSVC) support 0.01 Tue Mar 19 04:00:45 2013 - Initial release LICENSE100644000765000024 4375513123001251 16063 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24This software is copyright (c) 2013 by Hideaki Ohno. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2013 by Hideaki Ohno. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2013 by Hideaki Ohno. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End META.json100644000765000024 450213123001251 16442 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24{ "abstract" : "Implementation of the HyperLogLog cardinality estimation algorithm", "author" : [ "Hideaki Ohno " ], "dynamic_config" : 0, "generated_by" : "Minilla/v3.0.12", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Algorithm-HyperLogLog", "no_index" : { "directory" : [ "t", "xt", "inc", "share", "eg", "examples", "author", "builder" ] }, "prereqs" : { "build" : { "requires" : { "File::Temp" : "0", "Test::Fatal" : "0.008", "Test::More" : "0.98" } }, "configure" : { "requires" : { "Module::Build" : "0.4005", "Module::Build::XSUtil" : "0.09" } }, "develop" : { "requires" : { "Software::License" : "0", "Test::CPAN::Meta" : "0", "Test::MinimumVersion::Fast" : "0.04", "Test::PAUSE::Permissions" : "0.04", "Test::Perl::Critic" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "0", "Test::Spellunker" : "v0.2.7" } }, "runtime" : { "requires" : { "Carp" : "0", "Digest::MurmurHash3::PurePerl" : "0.02", "XSLoader" : "0", "perl" : "5.008008" } } }, "provides" : { "Algorithm::HyperLogLog" : { "file" : "lib/Algorithm/HyperLogLog.pm", "version" : "0.24" }, "Algorithm::HyperLogLog::PP" : { "file" : "lib/Algorithm/HyperLogLog/PP.pm", "version" : "0.24" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/hideo55/p5-Algorithm-HyperLogLog/issues" }, "homepage" : "https://github.com/hideo55/p5-Algorithm-HyperLogLog", "repository" : { "url" : "git://github.com/hideo55/p5-Algorithm-HyperLogLog.git", "web" : "https://github.com/hideo55/p5-Algorithm-HyperLogLog" } }, "version" : "0.24", "x_contributors" : [ "Damian Gryski ", "hideo55 " ] } README.md100644000765000024 445313123001251 16305 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24[![Build Status](https://travis-ci.org/hideo55/p5-Algorithm-HyperLogLog.svg?branch=master)](https://travis-ci.org/hideo55/p5-Algorithm-HyperLogLog) # NAME Algorithm::HyperLogLog - Implementation of the HyperLogLog cardinality estimation algorithm # SYNOPSIS use Algorithm::HyperLogLog; my $hll = Algorithm::HyperLogLog->new(14); while(<>){ $hll->add($_); } my $cardinality = $hll->estimate(); # Estimate cardinality $hll->dump_to_file('hll_register.dump');# Dumps internal data Construct object from dumped file. use Algorithm::HyperLogLog; # Restore internal state my $hll = Algorithm::HyperLogLog->new_from_file('hll_register.dump'); # DESCRIPTION This module is implementation of the HyperLogLog algorithm. HyperLogLog is an algorithm for estimating the cardinality of a set. # METHODS ## new($b) Constructor. \`$b\` is the parameter for determining register size. (The register size is 2^$b.) \`$b\` must be a integer between 4 and 16. ## new\_from\_file($filename) This method constructs object and restore the internal data of object from dumped file(dumped by dump\_to\_file() method). ## dump\_to\_file($filename) This method dumps the internal data of an object to a file. ## add($data) Adds element to the cardinality estimator. ## estimate() Returns estimated cardinality value in floating point number. ## merge($other) Merges the estimate from 'other' into this object, returning the estimate of their union. ## register\_size() Return number of register.(In the XS implementation, this equals size in bytes) ## XS() If using XS backend, this method return true value. # SEE ALSO Philippe Flajolet, Éric Fusy, Olivier Gandouet and Frédéric Meunier. HyperLogLog: the analysis of a near-optimal cardinality estimation algorithm. 2007 Conference on Analysis of Algorithms, DMTCS proc. AH, pp. 127–146, 2007. [http://algo.inria.fr/flajolet/Publications/FlFuGaMe07.pdf](http://algo.inria.fr/flajolet/Publications/FlFuGaMe07.pdf) # AUTHOR Hideaki Ohno # THANKS TO MurmurHash3([https://github.com/PeterScott/murmur3](https://github.com/PeterScott/murmur3)) - Austin Appleby - Peter Scott # LICENSE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. MyBuilder.pm100644000765000024 127113123001251 20701 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/builderpackage builder::MyBuilder; use strict; use warnings FATAL => 'all'; use 5.008008; use base 'Module::Build::XSUtil'; sub new { my ( $self, %args ) = @_; $self->SUPER::new( %args, allow_pureperl => 1, c_source => 'xs', xs_files => { './xs/hyperloglog.xs' => './lib/Algorithm/HyperLogLog.xs', }, add_to_cleanup => [ 'Algorithm-HyperLogLog-*', 'MANIFEST.bak', 'lib/Algorithm/*.o', 'lib/Algorithm/*.h', 'lib/Algorithm/*.c', 'lib/Algorithm/*.xs', ], meta_add => { keywords => [qw/HyperLogLog cardinality/], }, generate_ppport_h => 'lib/Algorithm/ppport.h', ); } 1; __END__ cpanfile100644000765000024 102213123001251 16517 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24#!perl requires 'perl' => '5.008008'; requires 'XSLoader'; requires 'Carp'; requires 'Digest::MurmurHash3::PurePerl' => '>=0.02'; on 'configure' => sub { requires 'Module::Build::XSUtil' => '>=0.09'; }; on 'build' => sub { requires 'Test::More' => '0.98'; requires 'Test::Fatal' => '0.008'; requires 'File::Temp'; }; on 'develop' => sub { requires 'Test::Spellunker'; requires 'Test::Perl::Critic'; requires 'Test::Pod'; requires 'Test::Pod::Coverage'; requires 'Software::License'; }; sample.pl100644000765000024 32213123001251 17206 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/eguse strict; use warnings; use utf8; use Algorithm::HyperLogLog; my $hll = Algorithm::HyperLogLog->new(10); while(<>){ next if !defined $_; $hll->add($_); } my $cardinality = $hll->estimate; __END__HyperLogLog.pm100644000765000024 716013123001251 22251 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/lib/Algorithmpackage Algorithm::HyperLogLog; use strict; use warnings; use 5.008008; use Carp qw(croak); our $VERSION = '0.24'; our $PERL_ONLY; if ( !defined $PERL_ONLY ) { $PERL_ONLY = $ENV{PERL_HLL_PUREPERL} ? 1 : 0; } if ( !exists $INC{'Algorithm/HyperLogLog/PP.pm'} ) { if ( !$PERL_ONLY ) { require XSLoader; $PERL_ONLY = !eval { XSLoader::load( __PACKAGE__, $VERSION ); }; } if ($PERL_ONLY) { require 'Algorithm/HyperLogLog/PP.pm'; } } sub new_from_file { my ( $class, $filename ) = @_; open my $fh, '<', $filename or die $!; my $on_error = sub { close $fh; croak "Invalid dump file($filename)"; }; binmode $fh; my ( @dumpdata, $buf, $readed ); # Read register size data $readed = read( $fh, $buf, 1 ); $on_error->() if $readed != 1; my $k = unpack 'C', $buf; # Read register content data my $m = 2**$k; $readed = read $fh, $buf, $m; $on_error->() if $readed != $m; close $fh; @dumpdata = unpack 'C*', $buf; my $self = $class->_new_from_dump( $k, \@dumpdata ); return $self; } sub dump_to_file { my ( $self, $filename ) = @_; my $k = log( $self->register_size ) / log(2); # Calculate log2(register_size) my $dumpdata = $self->_dump_register(); open my $fh, '>', $filename or die $!; binmode $fh; my $buf = pack 'C', $k; print $fh $buf; $buf = pack 'C*', @$dumpdata; print $fh $buf; close $fh; } sub XS { !$PERL_ONLY; } 1; __END__ =pod =encoding utf8 =head1 NAME Algorithm::HyperLogLog - Implementation of the HyperLogLog cardinality estimation algorithm =head1 SYNOPSIS use Algorithm::HyperLogLog; my $hll = Algorithm::HyperLogLog->new(14); while(<>){ $hll->add($_); } my $cardinality = $hll->estimate(); # Estimate cardinality $hll->dump_to_file('hll_register.dump');# Dumps internal data Construct object from dumped file. use Algorithm::HyperLogLog; # Restore internal state my $hll = Algorithm::HyperLogLog->new_from_file('hll_register.dump'); =head1 DESCRIPTION This module is implementation of the HyperLogLog algorithm. HyperLogLog is an algorithm for estimating the cardinality of a set. =head1 METHODS =head2 new($b) Constructor. `$b` is the parameter for determining register size. (The register size is 2^$b.) `$b` must be a integer between 4 and 16. =head2 new_from_file($filename) This method constructs object and restore the internal data of object from dumped file(dumped by dump_to_file() method). =head2 dump_to_file($filename) This method dumps the internal data of an object to a file. =head2 add($data) Adds element to the cardinality estimator. =head2 estimate() Returns estimated cardinality value in floating point number. =head2 merge($other) Merges the estimate from 'other' into this object, returning the estimate of their union. =head2 register_size() Return number of register.(In the XS implementation, this equals size in bytes) =head2 XS() If using XS backend, this method return true value. =head1 SEE ALSO Philippe Flajolet, Éric Fusy, Olivier Gandouet and Frédéric Meunier. HyperLogLog: the analysis of a near-optimal cardinality estimation algorithm. 2007 Conference on Analysis of Algorithms, DMTCS proc. AH, pp. 127–146, 2007. L =head1 AUTHOR Hideaki Ohno Ehide.o.j55 {at} gmail.comE =head1 THANKS TO MurmurHash3(L) =over 4 =item Austin Appleby =item Peter Scott =back =head1 LICENSE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut PP.pm100644000765000024 557313123001251 22576 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/lib/Algorithm/HyperLogLogpackage Algorithm::HyperLogLog::PP; use strict; use warnings; use 5.008008; use Carp (); use Digest::MurmurHash3::PurePerl qw(murmur32); use constant { HLL_HASH_SEED => 313, TWO_32 => 4294967296.0, NEG_TWO_32 => -4294967296.0, }; our $VERSION = "0.24"; require Algorithm::HyperLogLog; { package Algorithm::HyperLogLog; our @ISA = qw(Algorithm::HyperLogLog::PP); } sub new { my ( $class, $k ) = @_; if ( $k < 4 || $k > 16 ) { Carp::croak "Number of ragisters must be in the range [4,16]"; } my $m = 1 << $k; my $registers = [ (0) x $m ]; my $alpha = 0; if ( $m == 16 ) { $alpha = 0.673; } elsif ( $m == 32 ) { $alpha = 0.697; } elsif ( $m == 64 ) { $alpha = 0.709; } else { $alpha = 0.7213 / ( 1.0 + 1.079 / $m ); } my $self = { k => $k, m => $m, registers => $registers, alphaMM => $alpha * $m * $m, }; bless $self, $class; return $self; } sub _new_from_dump { my ( $class, $k, $data ) = @_; my $self = $class->new($k); $self->{registers} = $data; return $self; } sub _dump_register { my $self = shift; return $self->{registers}; } sub register_size { my $self = shift; return $self->{m}; } sub add { my ( $self, @data_list ) = @_; for my $data (@data_list) { my $hash = murmur32( $data, HLL_HASH_SEED ); my $index = ( $hash >> ( 32 - $self->{'k'} ) ); my $rank = _rho( ( $hash << $self->{k} ), 32 - $self->{k} ); if ( $rank > $self->{registers}[$index] ) { $self->{registers}[$index] = $rank; } } } sub estimate { my $self = shift; my $m = $self->{m}; my $rank = 0; my $sum = 0.0; for my $i ( 0 .. ( $m - 1 ) ) { $rank = $self->{registers}[$i]; $sum += 1.0 / ( 2.0**$rank ); } my $estimate = $self->{alphaMM} * ( 1.0 / $sum ); # E in the original paper if ( $estimate <= 2.5 * $m ) { my $v = 0; for my $i ( 0 .. ( $m - 1 ) ) { if ( $self->{registers}[$i] == 0 ) { $v++; } } if ( $v != 0 ) { $estimate = $m * log( $m / $v ); } } elsif ( $estimate > ( 1.0 / 30.0 ) * TWO_32 ) { $estimate = NEG_TWO_32 * log( 1.0 - ( $estimate / TWO_32 ) ); } return $estimate; } sub merge { my ($self, $other) = @_; my $m = $self->{m}; die "hll size misatch" if $self->{m} != $other->{m}; for (my $i=0; $i<$m; $i++) { if ($self->{registers}[$i] < $other->{registers}[$i]) { $self->{registers}[$i] = $other->{registers}[$i]; } } } sub XS { 0; } sub _rho { my ( $x, $b ) = @_; my $v = 1; while ( $v <= $b && !( $x & 0x80000000 ) ) { $v++; $x <<= 1; } return $v; } 1; __END__ minil.toml100644000765000024 26513123001252 17011 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24badges = ['travis'] module_maker='ModuleBuild' [build] build_class = "builder::MyBuilder" [no_index] directory = ['t', 'xt', 'inc', 'share', 'eg', 'examples', 'author', 'builder'] 00_compile.t100644000765000024 26013123001252 17356 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/tuse strict; use warnings; use Test::More tests => 1; BEGIN { use_ok( 'Algorithm::HyperLogLog' ); } diag( "Testing Algorithm::HyperLogLog $Algorithm::HyperLogLog::VERSION" ); 01_new.t100644000765000024 202513123001252 16541 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/tuse strict; use warnings; use Test::More; use Test::Fatal qw(exception lives_ok); use Algorithm::HyperLogLog; use Algorithm::HyperLogLog::PP; my $hll = Algorithm::HyperLogLog->new(5); is $hll->register_size, 2**5; isa_ok $hll, 'Algorithm::HyperLogLog'; like exception { Algorithm::HyperLogLog->new(3); }, qr/^Number of ragisters must be in the range \[4,16\]/; like exception { Algorithm::HyperLogLog->new(17); }, qr/^Number of ragisters must be in the range \[4,16\]/; lives_ok { Algorithm::HyperLogLog->new(4); }; lives_ok { Algorithm::HyperLogLog->new(16); }; my $hllpp = Algorithm::HyperLogLog::PP->new(5); is $hllpp->register_size, 2**5; isa_ok $hllpp, 'Algorithm::HyperLogLog::PP'; like exception { Algorithm::HyperLogLog::PP->new(3); }, qr/^Number of ragisters must be in the range \[4,16\]/; like exception { Algorithm::HyperLogLog::PP->new(17); }, qr/^Number of ragisters must be in the range \[4,16\]/; lives_ok { Algorithm::HyperLogLog::PP->new(4); }; lives_ok { Algorithm::HyperLogLog::PP->new(16); }; done_testing(); __END__ 02_basic.t100644000765000024 302313123001252 17031 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/tuse strict; use warnings; use Test::More; use Test::Fatal qw(exception lives_ok); use Algorithm::HyperLogLog; use Algorithm::HyperLogLog::PP; plan skip_all => 'No XS' unless Algorithm::HyperLogLog->XS; my $error_sum = 0; my $repeat = 100; for ( 1 .. $repeat ) { my $hll = Algorithm::HyperLogLog->new(16); my $hllpp = Algorithm::HyperLogLog::PP->new(16); my %unique = ( q{} => 1 ); for ( 0 .. 999 ) { my $str = q{}; while ( exists $unique{$str} ) { $str = random_string(10); } $unique{$str} = 1; $hll->add($str); $hllpp->add($str); } $unique{'foo'} = 1; for ( 0 .. 999 ) { $hll->add('foo'); $hllpp->add('foo'); } $unique{'bar'} = 1; for ( 0 .. 999 ) { $hll->add('bar'); $hllpp->add('bar'); } my $cardinality = $hll->estimate; my $cardinalitypp = $hllpp->estimate; if ( int($cardinality) == int($cardinalitypp) ) { ok 1, 'XS and PP compatibility test'; } else { diag $cardinality; diag $cardinalitypp; fail(); } my $unique = scalar keys %unique; $error_sum += abs( $unique - $cardinality ); } my $error_avg = $error_sum / $repeat; my $error_ratio = $error_avg / 10001 * 100; ok $error_ratio < 1.0, 'Error ratio less than 1.0%'; done_testing(); sub random_string { my $n = shift; my $str = q{}; for ( 1 .. $n ) { my $rand = rand(26); $str .= chr( ord('A') + $rand ); } return $str; } __END__ 03_pp.t100644000765000024 170313123001252 16373 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/tuse strict; use warnings; use Test::More; use Test::Fatal qw(exception lives_ok); BEGIN { $Algorithm::HyperLogLog::PERL_ONLY = 1; } use Algorithm::HyperLogLog; my $hll = Algorithm::HyperLogLog->new(16); isa_ok $hll, 'Algorithm::HyperLogLog'; ok !$hll->XS, 'is Pure Perl?'; my $error_sum = 0; my $repeat = 100; for ( 1 .. $repeat ) { my %unique; for ( 0 .. 999 ) { my $str = q{}; while ( exists $unique{$str} ) { $str = random_string(10); } $unique{$str} = 1; } $hll->add( keys %unique ); my $num = scalar keys %unique; my $error_sum += abs( $num - $hll->estimate() ); } my $error_avg = $error_sum / $repeat; my $error_ratio = $error_avg / 1000 * 100; ok $error_ratio < 1; done_testing(); sub random_string { my $n = shift; my $str = q{}; for ( 1 .. $n ) { my $rand = rand(26); $str .= chr( ord('A') + $rand ); } return $str; } 1; __END__ 04_dump_restore.t100644000765000024 205713123001252 20470 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/tuse strict; use warnings; use Test::More; use Test::Fatal qw(exception lives_ok); use File::Temp; use Algorithm::HyperLogLog; plan 'skip_all' => 'No XS' if !Algorithm::HyperLogLog->XS; subtest 'dump and restore - immediately after initialize' => sub { my $hll = Algorithm::HyperLogLog->new(5); my $dumpfile = File::Temp->new(); lives_ok { $hll->dump_to_file( $dumpfile->filename ); }; my $hll_r = Algorithm::HyperLogLog->new_from_file( $dumpfile->filename ); is $hll_r->register_size, $hll->register_size; is $hll_r->estimate(), $hll->estimate(); }; subtest 'dump and restore' => sub { my $hll = Algorithm::HyperLogLog->new(16); $hll->add('foo'); $hll->add('bar'); $hll->add('baz'); my $dumpfile = File::Temp->new(); lives_ok { $hll->dump_to_file( $dumpfile->filename ); }; my $hll_r = Algorithm::HyperLogLog->new_from_file( $dumpfile->filename ); is $hll_r->register_size, $hll->register_size; is $hll_r->estimate(), $hll->estimate(); }; done_testing(); 1; 05_dump_restore_pp.t100644000765000024 205113123001252 21162 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/tuse strict; use warnings; use Test::More; use Test::Fatal qw(exception lives_ok); use File::Temp; BEGIN { $Algorithm::HyperLogLog::PERL_ONLY = 1; } use Algorithm::HyperLogLog; subtest 'dump and restore - immediately after initialize' => sub { my $hll = Algorithm::HyperLogLog->new(5); my $dumpfile = File::Temp->new(); lives_ok { $hll->dump_to_file( $dumpfile->filename ); }; my $hll_r = Algorithm::HyperLogLog->new_from_file( $dumpfile->filename ); is $hll_r->register_size, $hll->register_size; is $hll_r->estimate(), $hll->estimate(); }; subtest 'dump and restore' => sub { my $hll = Algorithm::HyperLogLog->new(16); $hll->add('foo'); $hll->add('bar'); $hll->add('baz'); my $dumpfile = File::Temp->new(); lives_ok { $hll->dump_to_file( $dumpfile->filename ); }; my $hll_r = Algorithm::HyperLogLog->new_from_file( $dumpfile->filename ); is $hll_r->register_size, $hll->register_size; is $hll_r->estimate(), $hll->estimate(); }; done_testing(); 1; 06_merge.t100644000765000024 137113123001252 17057 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/tuse strict; use warnings; use Test::More; use Test::Fatal qw(exception lives_ok); use Algorithm::HyperLogLog; use Algorithm::HyperLogLog::PP; SKIP: { skip "No XS" unless Algorithm::HyperLogLog->XS; my $hlla = Algorithm::HyperLogLog->new(16); my $hllb = Algorithm::HyperLogLog->new(16); $hlla->add($_) for 1 .. 100_000; $hllb->add($_) for 100_000 .. 200_000; $hlla->merge($hllb); ok( abs( $hlla->estimate - 200_000 ) / 200_000 < 0.01 ); } my $hllppa = Algorithm::HyperLogLog::PP->new(16); my $hllppb = Algorithm::HyperLogLog::PP->new(16); $hllppa->add($_) for 1 .. 100_000; $hllppb->add($_) for 100_000 .. 200_000; $hllppa->merge($hllppb); ok( abs( $hllppa->estimate - 200_000 ) / 200_000 < 0.01 ); done_testing(); __END__ typemap100644000765000024 31713123001252 16404 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24HLL T_PTROBJ_HLL uint32_t T_UV ################################################################ INPUT T_PTROBJ_HLL $var = GET_HLLPTR($arg); OUTPUT T_PTROBJ_HLL sv_setref_pv($arg, klass, (void*)$var); hyperloglog.xs100644000765000024 1217013123001252 20403 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/xs#define PERL_NO_GET_CONTEXT #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" #include "murmur3.h" #define MAGIC 1 #define HLL_HASH_SEED 313 typedef struct HyperLogLog { uint32_t m; /// register num uint8_t k; /// register bit width uint8_t* registers; double alphaMM; /// alpha * m^2 }*HLL; #define GET_HLLPTR(x) get_hll(aTHX_ x, "$self") static const double two_32 = 4294967296.0; static const double neg_two_32 = -4294967296.0; /** * Extract pointer of struct HyperLogLog from SV. * * @param[in] object Perl object * @param[in] context */ static HLL get_hll(pTHX_ SV* object, const char* context) { SV *sv; IV address; if (MAGIC) SvGETMAGIC(object); if (!SvROK(object)) { if (SvOK(object)) croak("%s is not a reference", context); croak("%s is undefined", context); } sv = SvRV(object); if (!SvOBJECT(sv)) croak("%s is not an object reference", context); if(!sv_derived_from(object,"Algorithm::HyperLogLog")) { croak("%s is not a Algorithm::HyperLogLog", context); } address = SvIV(sv); if (!address) croak("Algorithm::HyperLogLog object %s has a NULL pointer", context); return INT2PTR(HLL, address); } /** * Initialize struct HyperLogLog * * @param[in] k paramater for determining register size * @return pointer of the intialized HLL */ static inline HLL initialize_hll(pTHX_ uint32_t k){ HLL hll = NULL; double alpha = 0.0; New(__LINE__, hll, 1, struct HyperLogLog); if( k < 4 || k > 16 ) { croak("Number of ragisters must be in the range [4,16]"); } hll->k = k; hll->m = 1 << hll->k; Newxz(hll->registers, hll->m, uint8_t); switch (hll->m) { case 16: alpha = 0.673; break; case 32: alpha = 0.697; break; case 64: alpha = 0.709; break; default: alpha = 0.7213/(1.0 + (1.079/(double) hll->m)); break; } hll->alphaMM = alpha * hll->m * hll->m; return hll; } /** * Returns position of the leftmost 1-bit of x. * * @param[in] x target of search 1-bit * @param[in] b bit width * @return position of the leftmost 1-bit of x */ static inline uint8_t rho(uint32_t x, uint8_t b) { uint8_t v = 1; while (v <= b && !(x & 0x80000000)) { v++; x <<= 1; } return v; } MODULE = Algorithm::HyperLogLog PACKAGE = Algorithm::HyperLogLog PROTOTYPES: DISABLE # Constructor HLL new(const char *klass, uint32_t k) CODE: { RETVAL = initialize_hll(aTHX_ k); } OUTPUT: RETVAL # Constructor(From dumped data) HLL _new_from_dump(const char *klass, uint32_t k, AV* data) PREINIT: uint32_t i; uint32_t len = 0; CODE: { RETVAL = initialize_hll(aTHX_ k); len = av_len(data); for(i = 0;i <= len;++i){ RETVAL->registers[i] = (uint8_t)SvUV(*av_fetch(data, i, 0)); } } OUTPUT: RETVAL # dump registers AV* _dump_register(HLL self) CODE: { RETVAL = (AV*)sv_2mortal((SV*)newAV()); uint32_t i; for(i = 0;i < self->m; i++){ av_push(RETVAL, newSVuv(self->registers[i])); } } OUTPUT: RETVAL # Return number of registers. uint32_t register_size(HLL self) CODE: RETVAL = self->m; OUTPUT: RETVAL # Add element to the estimator void add(HLL self, ...) PREINIT: uint32_t hash; uint32_t index; uint8_t rank; I32 arg_index; STRLEN n_a; CODE: { if(items > 1){ for(arg_index = 1; arg_index < items; ++arg_index){ char* str = SvPV(ST(arg_index), n_a); MurmurHash3_32((void *) str, strlen(str), HLL_HASH_SEED, (void *) &hash); index = (hash >> (32 - self->k)); rank = rho( (hash << self->k), 32 - self->k ); if( rank > self->registers[index] ) { self->registers[index] = rank; } } } } # Estimate cardinality double estimate(HLL self) CODE: { double estimate; uint32_t m = self->m; uint32_t i = 0; double sum = 0.0; // Calculate hermonic mean for (i = 0; i < m; i++) { sum += 1.0/pow(2.0, self->registers[i]); } estimate = self->alphaMM/sum; // E in the original paper if( estimate <= 2.5 * m ) { uint32_t zeros = 0;// V in the original paper uint32_t i = 0; for (i = 0; i < m; i++) { if (self->registers[i] == 0) { zeros++; } } if( zeros != 0 ) { estimate = m * log((double)m/zeros); } } else if (estimate > (1.0/30.0) * two_32) { estimate = neg_two_32 * log(1.0 - ( estimate/two_32 ) ); } RETVAL = estimate; } OUTPUT: RETVAL # Merge two HLLs double merge(HLL self, HLL other) CODE: { uint32_t m = self->m; uint32_t i = 0; if (m != other->m) { croak("hll size mismatch: %d != %d\n", m, other->m); } for (i = 0; i < m; i++) { if (self->registers[i] < other->registers[i]) { self->registers[i] = other->registers[i]; } } XSRETURN_UNDEF; } OUTPUT: RETVAL # Destructor void DESTROY(HLL self) CODE: { Safefree(self->registers); Safefree (self); } murmur3.h100644000765000024 734613123001252 17250 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/xs#ifndef MURMUR3_H #define MURMUR3_H //----------------------------------------------------------------------------- // MurmurHash3 was written by Austin Appleby, and is placed in the public // domain. The author hereby disclaims copyright to this source code. // Note - The x86 and x64 versions do _not_ produce the same results, as the // algorithms are optimized for their respective platforms. You can still // compile and run any of them on any platform, but your performance with the // non-native version will be less than optimal. //----------------------------------------------------------------------------- // Platform-specific functions and macros // Microsoft Visual Studio #if defined(_MSC_VER) #define FORCE_INLINE __forceinline typedef unsigned char uint8_t; typedef unsigned long uint32_t; typedef unsigned __int64 uint64_t; // Other compilers #else // defined(_MSC_VER) #include #endif // !defined(_MSC_VER) #define FORCE_INLINE inline __attribute__((always_inline)) inline uint32_t rotl32(uint32_t x, int8_t r) { return (x << r) | (x >> (32 - r)); } #define BIG_CONSTANT(x) (x##LLU) /* NO-OP for little-endian platforms */ #if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) # if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ # define BYTESWAP(x) (x) # endif /* if __BYTE_ORDER__ is not predefined (like FreeBSD), use arch */ #elif defined(__i386) || defined(__x86_64) \ || defined(__alpha) || defined(__vax) # define BYTESWAP(x) (x) /* use __builtin_bswap32 if available */ #elif defined(__GNUC__) || defined(__clang__) #ifdef __has_builtin #if __has_builtin(__builtin_bswap32) #define BYTESWAP(x) __builtin_bswap32(x) #endif // __has_builtin(__builtin_bswap32) #endif // __has_builtin #endif // defined(__GNUC__) || defined(__clang__) /* last resort (big-endian w/o __builtin_bswap) */ #ifndef BYTESWAP # define BYTESWAP(x) ((((x)&0xFF)<<24) \ |(((x)>>24)&0xFF) \ |(((x)&0x0000FF00)<<8) \ |(((x)&0x00FF0000)>>8) ) #endif //----------------------------------------------------------------------------- // Block read - if your platform needs to do endian-swapping or can only // handle aligned reads, do the conversion here #define getblock(p, i) BYTESWAP(p[i]) //----------------------------------------------------------------------------- // Finalization mix - force all bits of a hash block to avalanche FORCE_INLINE uint32_t fmix32(uint32_t h) { h ^= h >> 16; h *= 0x85ebca6b; h ^= h >> 13; h *= 0xc2b2ae35; h ^= h >> 16; return h; } //----------------------------------------------------------------------------- #ifdef __cplusplus extern "C" #else extern #endif void MurmurHash3_32(const void * key, int len, uint32_t seed, void * out) { const uint8_t * data = (const uint8_t*) key; const int nblocks = len / 4; int i; uint32_t h1 = seed; uint32_t c1 = 0xcc9e2d51; uint32_t c2 = 0x1b873593; //---------- // body const uint32_t * blocks = (const uint32_t *) (data + nblocks * 4); for (i = -nblocks; i; i++) { uint32_t k1 = getblock(blocks,i); k1 *= c1; k1 = rotl32(k1,15); k1 *= c2; h1 ^= k1; h1 = rotl32(h1,13); h1 = h1 * 5 + 0xe6546b64; } //---------- // tail { const uint8_t * tail = (const uint8_t*) (data + nblocks * 4); uint32_t k1 = 0; switch (len & 3) { case 3: k1 ^= tail[2] << 16; case 2: k1 ^= tail[1] << 8; case 1: k1 ^= tail[0]; k1 *= c1; k1 = rotl32(k1,15); k1 *= c2; h1 ^= k1; }; } //---------- // finalization h1 ^= len; h1 = fmix32(h1); *(uint32_t*) out = h1; } #endif perlcritic.t100644000765000024 33313123001252 17760 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/xtuse strict; use Test::More; eval { require Test::Perl::Critic; Test::Perl::Critic->import( -profile => 'xt/perlcriticrc'); }; plan skip_all => "Test::Perl::Critic is not installed." if $@; all_critic_ok('lib'); perlcriticrc100644000765000024 17713123001252 20051 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/xt[TestingAndDebugging::ProhibitNoStrict] allow=refs [-BuiltinFunctions::ProhibitStringyEval] [-Modules::RequireBarewordIncludes]pod_coverage.t100644000765000024 51213123001252 20254 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24/xtuse strict; use Test::More; eval "use Test::Pod::Coverage"; plan skip_all => "Test::Pod::Coverage required for testing POD coverage" if $@; my %INNER_CLASSES = map { $_ => 1 } qw/ Algorithm::HyperLogLog::PP /; for my $pkg ( grep { !exists $INNER_CLASSES{$_} } all_modules() ) { pod_coverage_ok($pkg); } done_testing; META.yml100644000765000024 232713123001252 16276 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24--- abstract: 'Implementation of the HyperLogLog cardinality estimation algorithm' author: - 'Hideaki Ohno ' build_requires: File::Temp: '0' Test::Fatal: '0.008' Test::More: '0.98' configure_requires: Module::Build: '0.4005' Module::Build::XSUtil: '0.09' dynamic_config: 0 generated_by: 'Minilla/v3.0.12, CPAN::Meta::Converter version 2.150001' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Algorithm-HyperLogLog no_index: directory: - t - xt - inc - share - eg - examples - author - builder provides: Algorithm::HyperLogLog: file: lib/Algorithm/HyperLogLog.pm version: '0.24' Algorithm::HyperLogLog::PP: file: lib/Algorithm/HyperLogLog/PP.pm version: '0.24' requires: Carp: '0' Digest::MurmurHash3::PurePerl: '0.02' XSLoader: '0' perl: '5.008008' resources: bugtracker: https://github.com/hideo55/p5-Algorithm-HyperLogLog/issues homepage: https://github.com/hideo55/p5-Algorithm-HyperLogLog repository: git://github.com/hideo55/p5-Algorithm-HyperLogLog.git version: '0.24' x_contributors: - 'Damian Gryski ' - 'hideo55 ' MANIFEST100644000765000024 56313123001252 16136 0ustar00hidestaff000000000000Algorithm-HyperLogLog-0.24Build.PL Changes LICENSE META.json README.md builder/MyBuilder.pm cpanfile eg/sample.pl lib/Algorithm/HyperLogLog.pm lib/Algorithm/HyperLogLog/PP.pm minil.toml t/00_compile.t t/01_new.t t/02_basic.t t/03_pp.t t/04_dump_restore.t t/05_dump_restore_pp.t t/06_merge.t typemap xs/hyperloglog.xs xs/murmur3.h xt/perlcritic.t xt/perlcriticrc xt/pod_coverage.t META.yml MANIFEST