Skip to content

Speed improvements for pack/unpack functions in protocol/types.py #1555

Closed
@billyevans

Description

@billyevans

I noticed that pack/unpack functions from https://github.com/dpkp/kafka-python/blob/master/kafka/protocol/types.py might be slightly improved. I made pre-compilation for them. It gives about 10% better performance compared to the current implementation.
Consumption of 100msg:

239884    0.187    0.000    0.287    0.000 types.py:18(_unpack) # new version
239884    0.192    0.000    0.323    0.000 types.py:17(_unpack)

I also made some profiling for producers/consumers. It gives about 1-1.5% time savings.
My changes billyevans@99bf021

Should I make a PR?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions