aio-libs / aio-libs/multidict

Giving multidict Cython Or PyCapsule Support?

Offen
#1,170 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
492
Forks
129
Ø Merge
14 Std. 28 Min.
Gemergte PRs (30 T.)
35

Beschreibung

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)

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.