aio-libs / aio-libs/multidict

Giving multidict Cython Or PyCapsule Support?

Aperta
#1,170 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
492
Fork
129
Merge medio
14h 28m
PR unite (30g)
35

Descrizione

I feel very tempted to ask if I could make it so that Cython could actually support multidict rather than just simply importing it since I feel that performance may steadily improve if this approach was implemented. This way instead of calling `import multidict` we could do something like `cimport multidict` I would assume that doing so would allow the following things in aiohttp to run a bit faster.

- The `_http_writer.pyx` Cython Code could have direct access to istr as a physical CPython Type allowing this check to be a little bit smoother.
- As for `_http_parser.pyx` this could be pretty significant as many of the `multidict` calls could be replaced for C-API Calls.

## Approach For Compiling
- As for compiling I'm looking to try and approach this the same way numpy would where a call like `_import_array()` could be implemented to import the Capsule.
- There could be an extra module that is specifically responsible for finding the header files at compile-time so that users who want to use multidict within cython can easily compile their code alongside with it.

If anybody is confused about what a capsule is I have a [link to it's documentation](https://docs.python.org/3.9/extending/extending.html#using-capsules)

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.