David -

The FastSieve module works pretty quickly, I must say. I do not need random
numbers on a regular basis, so I can't compare it with other modules.
However, computing and printing the first 5 million primes is pretty quick,
quick enough that I don't notice an appreciable delay between when I hit
Enter and when the results start printing. I would also point out that
every single function is written in C++ and there are no need for Perl-side
wrappers. Very nice!

For anybody else who might want to try it out, I would point out that David
uploaded v 0.02 and my CPAN only wanted to install v 0.01. Unfortunately,
0.01 wants Perl 5.14.2, so it didn't install on my machine. If you have an
older Perl (I have 5.14.1), you might have better luck with this command:

cpan D/DA/DAVIDO/Math-Prime-FastSieve-0.02.tar.gz

The only gripe that I have is that the docs have a slightly unconventional
POD structure. The Synopsis section could be improved with comment lines
explaining what each function does. However, the docs are complete, so it's
really only a minor gripe. Also, this module is a proof-of-concept for
Inline::CPP, so the docs don't need to be perfect.

Great work!
David

On Mon, Dec 12, 2011 at 6:48 AM, David Mertens <dcmertens.p...@gmail.com>wrote:

> Nice work! I'll have to give it a look later today.
>
> David
> On Dec 12, 2011 1:12 AM, "David Oswald" <daosw...@gmail.com> wrote:
>
>> 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
>>
>


-- 
Sent via my carrier pigeon.

Reply via email to