Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Re: Re: Hypergeometric Probability Calculation (speeding up 'choose' )

by Itatsumaki (Friar)
on Mar 22, 2004 at 05:28 UTC ( [id://338557]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Hypergeometric Probability Calculation (speeding up 'choose' )
in thread Hypergeometric Probability Calculation

Just looking back at this now and saw your updates. I wonder Math::Big couldn't/shouldn't be rewritten to use C-code for large integer operations. My thought is that even if Perl itself isn't good for numerical calculations, when using a CPAN module for it, an XS implementation for processing would be a big performance win, without much of a complexity increase for module-users.

-Tats
  • Comment on Re: Re: Re: Hypergeometric Probability Calculation (speeding up 'choose' )

Replies are listed 'Best First'.
Re: Re: Re: Re: Hypergeometric Probability Calculation (speeding up 'choose' )
by tilly (Archbishop) on Mar 23, 2004 at 02:42 UTC
    Install Math::BigInt::GMP and use Math::BigInt lib => 'GMP'; and things get much faster. You can distribute code in with that use, without the module locally installed everything still works, it just falls back on a slow Perl version. (Some may prefer Math::BigInt::Pari.)

    Math::Big is meant to be a convenient wrapper around other modules. Use a faster one and it gets faster. Use a slower one, and it isn't.

      sweet, this works great! Thanks tilly

      -Tats
Re: Re: Re: Re: Hypergeometric Probability Calculation (speeding up 'choose' )
by QM (Parson) on Mar 22, 2004 at 05:44 UTC
    There is a module that uses XS instead of pure Perl (but I forget the name, and can't find it quickly - perhaps someone will enlighten us?).

    However, pure Perl solutions are useful for users and situations where XS is not available, even though it's slower.

    As stated earlier, pure Perl is not always the best choice when number crunching speed is of critical importance.

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://338557]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-24 19:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found