Skip to content

Giving multidict Cython Or PyCapsule Support? #1170

@Vizonex

Description

@Vizonex

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions