Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimise Decimal binary dumper #54

Open
dvarrazzo opened this issue May 10, 2021 · 0 comments
Open

Optimise Decimal binary dumper #54

dvarrazzo opened this issue May 10, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@dvarrazzo
Copy link
Member

There are now dumper/loader to adapt Python Decimal to Postgres numeric in binary format, implemented both in C and in Cython.

These methods however are about the 30% slower than the text format adapters (at least the dumper). The problem is that, even in C, the binary dumper uses the Decimal.as_tuple() method, which is relatively slow.

An API to access the Decimal C values should be available in Python 3.10: https://bugs.python.org/issue41324 The C adapters should use it.

There is a draft of a branch where I was thinking to use the mpdec directly, but this would complicate the build at it requires the libmpdec-dev package. So it's probably a bad idea.

@dvarrazzo dvarrazzo added the enhancement New feature or request label Aug 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant