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

Investigate cython descriptors for orm attributes #11238

Open
CaselIT opened this issue Apr 5, 2024 · 4 comments
Open

Investigate cython descriptors for orm attributes #11238

CaselIT opened this issue Apr 5, 2024 · 4 comments
Labels
cextensions issues with the C/cython extensions orm performance where performance can be improved. add "bug" only if it's a performance degradation
Milestone

Comments

@CaselIT
Copy link
Member

CaselIT commented Apr 5, 2024

It seems that they provide a fair bit of advantage compared to python descriptors.

See #4462 (comment)

@CaselIT CaselIT added orm performance where performance can be improved. add "bug" only if it's a performance degradation labels Apr 5, 2024
@CaselIT CaselIT changed the title Investigate cython descriptor for orm attributes Investigate cython descriptors for orm attributes Apr 5, 2024
@CaselIT CaselIT added this to the 2.1 milestone Apr 5, 2024
@CaselIT CaselIT added the cextensions issues with the C/cython extensions label Apr 7, 2024
@CarlosEduR
Copy link
Contributor

@CaselIT I've been interested about performance, is there anything I could help here somehow?

@CaselIT
Copy link
Member Author

CaselIT commented Apr 15, 2024

Hi @CarlosEduR. The orm may not be the easiest part to interact with, but if you want to try, by all means.

Did you have something in mind regarding what part of performance were you interested in improving?

In this issue the idea would be to try and extract the base orm descriptor so that they can be compiled using cython.
This is assuming that the quick test done in the linked comment holds for the actual sqlalchemy use case

@CarlosEduR
Copy link
Contributor

@CaselIT I don't have anything in mind yet, just got interested and curious about it. I'll take a better look at the base orm descriptor. I have never worked with cython, but that's interesting...

@CaselIT
Copy link
Member Author

CaselIT commented Apr 19, 2024

If you want to try it, the general idea here could be to extract the basic functionality in a superclass, that could be compiled to cython.

You can look into BaseRow in lib/sqlalchemy/engine/_row_cy.py for an example

Also note that it may be that it makes no difference in a real use case, I have just done the simplest test in the referenced comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cextensions issues with the C/cython extensions orm performance where performance can be improved. add "bug" only if it's a performance degradation
Projects
None yet
Development

No branches or pull requests

2 participants