From: casevh on
Everyone,

I'm pleased to annouce that a new version of GMPY is available.
GMPY is a wrapper for the MPIR or GMP multiple-precision
arithmetic library. GMPY 1.11rc1 is available for download from:

http://code.google.com/p/gmpy/

In addition to support for Python 3.x, there are several new
features in this release:

- Even faster conversion to/from Python longs.
- Performance improvements by reducing function overhead.
- Performance improvements by improved caching.
- Support for cdivmod, fdivmod, and tdivmod.
- Unicode strings are accepted on Python 2.x and 3.x.
- Fixed regression in GMPY 1.10 where True/False were no
longer recognized.

Comments on provided binaries

The 32-bit Windows installers were compiled with MinGW32 using MPIR
1.3.0rc3 and will automatically recognize the CPU type and use code
optimized for the CPU at runtime. The 64-bit Windows installers were
compiled Microsoft's SDK compilers using MPRI 1.3.0rc3. Detailed
instructions are included if you want to compile your own binary.

Future plans

On releasing the GIL: I have compared releasing the GIL versus the
multiprocessing module and the multiprocessing module offers better
and more predictable performance for embarrassingly parallel tasks
than releasing the GIL. If there are requests, I can add a compile-
time option to enable threading support but it is unlikely to
become the default.

On mutable integers: The performance advantages of mutable integers
appears to be 20% to 30% for some operations. I plan to add a new
mutable integer type in the next release of GMPY. If you want to
experiment with mutable integers now, GMPY can be compiled with
mutable version of the standard 'mpz' type. Please see the file
"mutable_mpz.txt" for more information.

Please report any issues!

casevh
From: Terry Reedy on
casevh wrote:
> Everyone,
>
> I'm pleased to annouce that a new version of GMPY is available.
> GMPY is a wrapper for the MPIR or GMP multiple-precision
> arithmetic library. GMPY 1.11rc1 is available for download from:

Is this an update of the gmpy (1.02) registered at
http://pypi.python.org/pypi/gmpy/1.02?

Either way, please list it (with modified name if needed) and note that
it is 3.x compatible so people searching for such packages can find it.

From: Nick Craig-Wood on
casevh <casevh(a)gmail.com> wrote:
> I'm pleased to annouce that a new version of GMPY is available.
> GMPY is a wrapper for the MPIR or GMP multiple-precision
> arithmetic library. GMPY 1.11rc1 is available for download from:
[snip]
> Future plans
>
> On releasing the GIL: I have compared releasing the GIL versus the
> multiprocessing module and the multiprocessing module offers better
> and more predictable performance for embarrassingly parallel tasks
> than releasing the GIL. If there are requests, I can add a compile-
> time option to enable threading support but it is unlikely to
> become the default.

You could have variant types of mpz etc which do release the GIL so
you could mix and match accordingly.

> On mutable integers: The performance advantages of mutable integers
> appears to be 20% to 30% for some operations. I plan to add a new
> mutable integer type in the next release of GMPY. If you want to
> experiment with mutable integers now, GMPY can be compiled with
> mutable version of the standard 'mpz' type. Please see the file
> "mutable_mpz.txt" for more information.

Mutable integers - whatever will they think of next ;-)

Thanks for maintaining gmpy - it is an excellent bit of software!

--
Nick Craig-Wood <nick(a)craig-wood.com> -- http://www.craig-wood.com/nick
From: Mensanator on
On Nov 29, 9:04 pm, casevh <cas...(a)gmail.com> wrote:
> Everyone,
>
> I'm pleased to annouce that a new version of GMPY is available.
> GMPY is a wrapper for the MPIR or GMP multiple-precision
> arithmetic library. GMPY 1.11rc1 is available for download from:
>
> http://code.google.com/p/gmpy/
>
> In addition to support for Python 3.x, there are several new
> features in this release:
>
> - Even faster conversion to/from Python longs.
> - Performance improvements by reducing function overhead.
> - Performance improvements by improved caching.
> - Support for cdivmod, fdivmod, and tdivmod.
> - Unicode strings are accepted on Python 2.x and 3.x.
> - Fixed regression in GMPY 1.10 where True/False were no
>   longer recognized.
>
> Comments on provided binaries
>
> The 32-bit Windows installers were compiled with MinGW32 using MPIR
> 1.3.0rc3 and will automatically recognize the CPU type and use code
> optimized for the CPU at runtime. The 64-bit Windows installers were
> compiled Microsoft's SDK compilers using MPRI 1.3.0rc3. Detailed
> instructions are included if you want to compile your own binary.
>
> Future plans
>
> On releasing the GIL: I have compared releasing the GIL versus the
> multiprocessing module and the multiprocessing module offers better
> and more predictable performance for embarrassingly parallel tasks
> than releasing the GIL. If there are requests, I can add a compile-
> time option to enable threading support but it is unlikely to
> become the default.
>
> On mutable integers: The performance advantages of mutable integers
> appears to be 20% to 30% for some operations. I plan to add a new
> mutable integer type in the next release of GMPY. If you want to
> experiment with mutable integers now, GMPY can be compiled with
> mutable version of the standard 'mpz' type. Please see the file
> "mutable_mpz.txt" for more information.
>
> Please report any issues!

By lucky coincidence I happen to be working on a Python implementation
of Brent's Cycle Detection algorithm to locate large loop cycles in
3n+C of the Collatz conjecture. I had the algorithm worked up in pure
Python but needed to implement it using gmpy to do the heavy lifting
(due to the breakdown of my C version).

I am happy to report that my initial tests using version 1.11 seem to
be a big improvement:

## home, vista, python 3.1, gmpy 1.10
## i: 2
## f1: 101
## f2: 401
## C: 40501
## loop @: 29593
## found in: 0.000 sec
## len(sv) 88 determined in: 0.000 sec
##
## i: 3
## f1: 1009
## f2: 4001
## C: 4037009
## loop @: 12799165
## found in: 0.000 sec
## len(sv) 76 determined in: 0.000 sec
##
## i: 4
## f1: 10007
## f2: 40009
## C: 400370063
## loop @: 933402925
## found in: 0.000 sec
## len(sv) 780 determined in: 0.000 sec
##
## i: 5
## f1: 100003
## f2: 400009
## C: 40002100027
## loop @: 13522904574967
## found in: 0.015 sec
## len(sv) 2233 determined in: 0.000 sec
##
## i: 6
## f1: 1000003
## f2: 4000037
## C: 4000049000111
## loop @: 1712218136639
## found in: 0.032 sec
## len(sv) 7789 determined in: 0.015 sec
##
## i: 7
## f1: 10000019
## f2: 40000003
## C: 400000790000057
## loop @: 2519240916548647
## found in: 0.219 sec
## len(sv) 51270 determined in: 0.078 sec
##
## i: 8
## f1: 100000007
## f2: 400000009
## C: 40000003700000063
## loop @: 7032060392244193
## found in: 0.452 sec
## len(sv) 110238 determined in: 0.172 sec
##
## i: 9
## f1: 1000000007
## f2: 4000000007
## C: 4000000035000000049
## loop @: 7486962189408734959
## found in: 3.276 sec
## len(sv) 668255 determined in: 1.014 sec
##
## i: 10
## f1: 10000000019
## f2: 40000000003
## C: 400000000790000000057
## loop @: 2513183598585048828239
## found in: 15.974 sec
## len(sv) 4104051 determined in: 6.240 sec
##
## i: 11
## f1: 100000000003
## f2: 400000000019
## C: 40000000003100000000057
## loop @: 43826676662614800299839
## found in: 104.754 sec
## len(sv) 20780131 determined in: 31.840 sec

Compare that to using version 1.11 (all else equal):

## home, vista, python 3.1, gmpy 1.11
##
## i: 2
## f1: 101
## f2: 401
## C: 40501
## loop @: 29593
## found in: 0.000 sec
## len(sv) 88 determined in: 0.000 sec
##
## i: 3
## f1: 1009
## f2: 4001
## C: 4037009
## loop @: 12799165
## found in: 0.000 sec
## len(sv) 76 determined in: 0.000 sec
##
## i: 4
## f1: 10007
## f2: 40009
## C: 400370063
## loop @: 933402925
## found in: 0.015 sec
## len(sv) 780 determined in: 0.000 sec
##
## i: 5
## f1: 100003
## f2: 400009
## C: 40002100027
## loop @: 13522904574967
## found in: 0.000 sec
## len(sv) 2233 determined in: 0.000 sec
##
## i: 6
## f1: 1000003
## f2: 4000037
## C: 4000049000111
## loop @: 1712218136639
## found in: 0.016 sec
## len(sv) 7789 determined in: 0.015 sec
##
## i: 7
## f1: 10000019
## f2: 40000003
## C: 400000790000057
## loop @: 2519240916548647
## found in: 0.140 sec
## len(sv) 51270 determined in: 0.047 sec
##
## i: 8
## f1: 100000007
## f2: 400000009
## C: 40000003700000063
## loop @: 7032060392244193
## found in: 0.296 sec
## len(sv) 110238 determined in: 0.109 sec
##
## i: 9
## f1: 1000000007
## f2: 4000000007
## C: 4000000035000000049
## loop @: 7486962189408734959
## found in: 2.200 sec
## len(sv) 668255 determined in: 0.624 sec
##
## i: 10
## f1: 10000000019
## f2: 40000000003
## C: 400000000790000000057
## loop @: 2513183598585048828239
## found in: 10.624 sec
## len(sv) 4104051 determined in: 3.931 sec
##
## i: 11
## f1: 100000000003
## f2: 400000000019
## C: 40000000003100000000057
## loop @: 43826676662614800299839
## found in: 69.295 sec
## len(sv) 20780131 determined in: 19.516 sec

Good work!

>
> casevh