File Coverage

blib/lib/Algorithm/EventsPerSecond/XS.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 11 11 100.0


line stmt bran cond sub pod time code
1             package Algorithm::EventsPerSecond::XS;
2              
3 11     11   156 use 5.006;
  11         30  
4 11     11   77 use strict;
  11         35  
  11         265  
5 11     11   47 use warnings;
  11         36  
  11         941  
6              
7             =head1 NAME
8              
9             Algorithm::EventsPerSecond::XS - XS accelerated backend for Algorithm::EventsPerSecond
10              
11             =head1 DESCRIPTION
12              
13             Do not use this module directly. L loads it
14             automatically when it is usable and falls back to pure Perl when it is not.
15              
16             The bucket counts and their timestamps are kept in packed C
17             buffers (Perl strings), so the window scan in C<_xs_count> runs over
18             contiguous memory. When compiled on a machine with AVX2 or SSE4.2 an
19             explicit SIMD path is used; otherwise a branchless scalar loop is
20             emitted that compilers readily auto-vectorize at C<-O3>.
21              
22             The XS is compiled when C runs, so the
23             environment variables below take effect at install time:
24              
25             =over 4
26              
27             =item IF_OPT
28              
29             The C<-O> optimization value. C (or C) compiles
30             with C<-O2>. Defaults to C<-O3>.
31              
32             =item IF_ARCH
33              
34             The target architecture. C (or C)
35             compiles with C<-march=native>, unlocking whatever SIMD the build host
36             supports. Unset by default, leaving the compiler's baseline.
37              
38             =back
39              
40             Passing C to C skips building the XS
41             entirely, as does lacking a working C compiler; in either case
42             L uses its pure Perl implementation.
43              
44             =cut
45              
46             our $VERSION = '0.0.1';
47              
48             require XSLoader;
49             XSLoader::load( 'Algorithm::EventsPerSecond::XS', $VERSION );
50              
51             =head1 AUTHOR
52              
53             Zane C. Bowers-Hadley, C<< >>
54              
55             =head1 LICENSE AND COPYRIGHT
56              
57             This software is Copyright (c) 2026 by Zane C. Bowers-Hadley.
58              
59             This is free software, licensed under:
60              
61             The GNU Lesser General Public License, Version 2.1, February 1999
62              
63             =cut
64              
65             1; # End of Algorithm::EventsPerSecond::XS