Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Really Fast Big Integer Library In C - Re: Re: Predict Random Numbers

by no_slogan (Deacon)
on Mar 14, 2002 at 17:19 UTC ( [id://151741]=note: print w/replies, xml ) Need Help??


in reply to Really Fast Big Integer Library In C - Re: Re: Predict Random Numbers
in thread Predict Random Numbers

Yes, compiled C code is much faster than perl for this task, I'm afraid. I have a C version that runs over 100 times faster than the perl, so it completes in a fraction of a second. I used GMP, which provides a wide variety of functions and has optimized assembly code for many platforms. Pari seems to be a bit faster, but the documentation is way over my head.

I see Math::BigIntFast is available in PPM form. Someone who was feeling ambitious could probably make that work, but the rational number support would have to be written.

  • Comment on Re: Really Fast Big Integer Library In C - Re: Re: Predict Random Numbers

Replies are listed 'Best First'.
Re: Re: Really Fast Big Integer Library In C - Re: Re: Predict Random Numbers
by Anonymous Monk on Mar 20, 2002 at 18:19 UTC

    Yes, compiled C code is much faster than perl for this task, I'm afraid. I have a C version that runs over 100 times faster than the perl, so it completes in a fraction of a second.

    Math::BigInt::Lite should help to address this problem, but the normal Perl overhead will always remain. Unless you use large numbers, where the most time will be spent in the GMP/Pari etc library, Perl will be always much slower, I am afraid.

    I see Math::BigIntFast is available in PPM form. Someone who was feeling ambitious could probably make that work, but the rational number support would have to be written.

    Math::BigIntFast is just a *very* thin (read: empty) wrapper around Bit::Vector. Besides that Bit::Vector is slower than GMP and Pari, it also has the problem that it only works with "fixed" sized numbers, e.g. you need to determine what the max. will be in front and than use that for all numbers - or do costly resizing all the time. And if you make it really so that it works with numbers of any size in mixed ways, you will just re-invent Math::BigInt::BitVector ;) HTH, Tels PS: Next time please sent me bug reports or feature requests, it is quite embarrassing reading about things that don't work on some random website you stumble over with google. I could have easily missed it for months or years. Thanx in advance!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-04-23 13:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found