⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@tarasko
Copy link
Contributor

@tarasko tarasko commented Jan 29, 2026

While looking at perf output I noticed that a new Long object was constructed before we call SSLObject.read
Indeed, Cython generates code to make a python object, because SSL_READ_MAX_SIZE is a constant of primitive type.
Since the value is big, it is not cached by Python, and a new object is constructed every time.

+591: if not self._sslobj_read(SSL_READ_MAX_SIZE):
__pyx_t_5 = NULL;
__Pyx_INCREF(__pyx_v_self->_sslobj_read);
__pyx_t_6 = __pyx_v_self->_sslobj_read;
__pyx_t_7 = __Pyx_PyLong_From___pyx_anon_enum(__pyx_e_6uvloop_4loop_SSL_READ_MAX_SIZE); if (unlikely(!__pyx_t_7)) __PYX_ERR(25, 591, __pyx_L3_error)
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_8 = 1;

@tarasko tarasko changed the title Optimize SSLObject.read call Minor optimization for SSLObject.read call Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant