I just wanted to get a proof of concept ironed out demonstrating the
concept of a CPAN module using Inline::CPP (as opposed to some
old-school XS approach).

Math::Prime::FastSieve is on CPAN now -- or as soon as your local
mirrors pick it up.  It implements the Primes Sieve of Eratosthenes
using a bit vector in C++, and serves it up to Perl via Inline::CPP.

The steps to making a module with Inline::CPP seem to be pretty much
exactly as illustrated in the Inline PODs here:

http://search.cpan.org/~sisyphus/Inline-0.49/Inline.pod#Writing_Modules_with_Inline

Since Inline::CPP is now passing about 93% of smoke tests (I'll work
on getting closer to 100% once the dust settles for the current round
of smoke testing), it's not unreasonable to use Inline::CPP in
real-world modules.

Oh, and why another Primes module?  Because this one beats
Math::Prime::XS in two important ways:
1: It works (well) up to 2.14 billion (M::P::XS craps out around 500M).
2: It is at minimum 21% faster than M::P::XS at any given 'n'.

...plus...

3: It's an evolution of code used in my presentation at LA Perl
Mongers and Thousand Oaks Perl Mongers on Inline::C.


The slides to my Inline::C presentation (with some discussion on
Inline::CPP as well) are here:
    http://www.box.com/s/svecm9hq1tam27ggdjds

Dave

-- 

David Oswald
daosw...@gmail.com

Reply via email to