You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm still building PyPy so I haven't tried the code yet.
I looked at the code and I have a couple of comments based on my experiences with gmpy/gmpy2.
When deleting an object, you should check the size of the object before deciding to save it. When I first added caching to gmpy, I didn't make the size check and consumed all memory when someone began working with very large numbers.
When converting a PyLong to an mpz, I access the internal structure - fast but not portable. Have you looked at the int.to_bytes method available in Python 3.x? It might be faster than repeated divmod. If you don't want to be version dependent, have you tried a combination of & and right shift?
I'll try to provide some additional comments after PyPy is running.
I'm impressed by how clean the CFFI code looks.
Case
The text was updated successfully, but these errors were encountered:
Thanks for the tips. The combination of rightshift and & caused about a 10x speedup assigning large mpzs (granted we're still about 3000x slower than gmpy/gmpy2).
I've been talking to the PyPy / cffi people, and hopefully we can improve the performance. I doubt we'll ever match gmpy's hand tuned C, but hopefully we can get it a bit closer.
I'm still building PyPy so I haven't tried the code yet.
I looked at the code and I have a couple of comments based on my experiences with gmpy/gmpy2.
When deleting an object, you should check the size of the object before deciding to save it. When I first added caching to gmpy, I didn't make the size check and consumed all memory when someone began working with very large numbers.
When converting a PyLong to an mpz, I access the internal structure - fast but not portable. Have you looked at the int.to_bytes method available in Python 3.x? It might be faster than repeated divmod. If you don't want to be version dependent, have you tried a combination of & and right shift?
I'll try to provide some additional comments after PyPy is running.
I'm impressed by how clean the CFFI code looks.
Case
The text was updated successfully, but these errors were encountered: