guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GMP bignum results using double cells.


From: Kevin Ryde
Subject: Re: GMP bignum results using double cells.
Date: Sat, 01 Mar 2003 08:45:58 +1000
User-agent: Gnus/5.090013 (Oort Gnus v0.13) Emacs/21.2 (i386-pc-linux-gnu)

Rob Browning <address@hidden> writes:
>
> The fact that all the values are so close makes me wonder if much of
> the cost is just interpreter related.

Perhaps bigger numbers would show up better.  The advantages of gmp
normally increase with increasing size.

> Note that I left the same algorithm as before for the inum case.

mpn_gcd_1 would be a possibility for that, to save some code.
Probably no great difference in speed normally, though gmp does have
some nice assembler versions for K6 and Athlon.

>     } else if (SCM_BIGP (y)) {
>       SCM result = scm_i_mkbig ();
>       SCM mx = scm_i_mkbig ();
>       mpz_set_si(SCM_I_BIG_MPZ (mx), SCM_INUM (x));
>       scm_remember_upto_here_1 (x);
>       mpz_gcd(SCM_I_BIG_MPZ (result), SCM_I_BIG_MPZ (mx), SCM_I_BIG_MPZ (y));

Could probably use mpz_gcd_ui instead of converting x to an mpz.

Unless I've missed something basic and a conversion should be done.
In which case maybe the result variable could be pressed into service,
convert into that and call mpz_gcd(result,result,y).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]