Re: [Nolug] In case you wanted to know how big 2 to the 3,000,000 is...

From: Friedrich Gurtler <fgurtler_at_tulane.edu>
Date: Thu, 01 Jul 2004 14:54:51 -0500
Message-ID: <40E46C0B.7060508@tulane.edu>

Pietu wrote:

> I believe there is two factors here at least.
>
>1) Motorola cpu is faster with equivalent Mhz than for example intel.
>However, with mac's except the very recent ones. The slow bottleneck has
>always been the stuff that's surrounding the cpu.
>2) the algorithm used for the calculations.
>
>P
>
>
My comment about the mac was very tongue in cheek. Heh.

It has everything to do with the algorithm.

I bothered to glance at the code for both the left shift and the power
functions, and it turns out that shift never checks for a base of 2 and
so never calls mpz_mul_2exp. It makes sense, since having a base of 2
is too rare of an case to justify checking every time. So for maximum
speed my code really should use the power function, since the left shift
just wraps the power function with some additional logic.

If you really wanted to be fast, you could either write another stub
function in the XS file that calls mpz_mul_2exp or you could just write
it in C.
___________________
Nolug mailing list
nolug@nolug.org
Received on 07/01/04

This archive was generated by hypermail 2.2.0 : 12/19/08 EST