aio-libs / aio-libs/multidict

Giving multidict Cython Or PyCapsule Support?

Abierto
#1,170 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
492
Forks
129
Merge medio
14 h 28 min
PR fusionados (30 d)
35

Descripción

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)

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.