MagicStack / MagicStack/py-pgproto

Some more cython optimizations ?

Open
#5 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Cython
Stars
38
Forks
21
PR merge metrics
No merged PRs in 30d

Description

While working on ChunkedBuffer:

https://github.com/tzickel/chunkedbuffer

I think it's for calling python methods which are already bound to a Python object, it's faster to do instead of (check the annotated output):

self._bufs_popleft(...)

this:

with cython.optimize.unpack_method_calls(False):
    self._bufs_popleft(...)

^^- but it's better to leave it though for calling other stuff, like when calling an .find directly.

Also instead of:

self._bufs = collections.deque()

it's less code

from collections import deque
self._bufs = deque()

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ChunkedBuffer and the linked chunkedbuffer project, then inspect the annotated output for the _bufs_popleft and collections.deque examples. Compare the proposed Cython optimization changes against the current behavior and performance; done means the worthwhile optimizations are identified and validated without changing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.