py-pgproto icon indicating copy to clipboard operation
py-pgproto copied to clipboard

Some more cython optimizations ?

Open tzickel opened this issue 5 years ago • 1 comments

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()

tzickel avatar May 03 '20 17:05 tzickel

I think these are micro-optimizations and it's highly unlikely that they would show a detectable speedup.

1st1 avatar May 04 '20 23:05 1st1