Skip to content

gh-100239: expose sq_repeat helpers for BINARY_OP_EXTEND - #148791

Merged
kumaraditya303 merged 3 commits into
python:mainfrom
NekoAsakura:gh-100239/expose-sq-repeat-helpers
May 8, 2026
Merged

kumaraditya303 merged 3 commits into
python:mainfrom
NekoAsakura:gh-100239/expose-sq-repeat-helpers

Conversation

@NekoAsakura

@NekoAsakura NekoAsakura commented Apr 20, 2026 •

Copy link
Copy Markdown
Member
main branch %
str * int 32.0 ns 26.4 ns -17.5%
int * str 32.7 ns 26.8 ns -18.0%
bytes * int 27.0 ns 23.1 ns -14.4%
int * bytes 27.2 ns 23.0 ns -15.4%
tuple * int 29.3 ns 24.9 ns -15.0%
int * tuple 29.7 ns 24.8 ns -16.5%
Comment thread Python/specialize.c Outdated
int_str_multiply(PyObject *lhs, PyObject *rhs)
{
return seq_int_multiply(rhs, lhs, PyUnicode_Type.tp_as_sequence->sq_repeat);
Py_ssize_t count = PyLong_AsSsize_t(lhs);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is repeated a couple of times, we could use a macro to define the methods (similar to FLOAT_LONG_ACTION). But current form is also fine with me.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. 17 insertions(+), 59 deletions(-).

@read-the-docs-community

Copy link
Copy Markdown
@NekoAsakura

Copy link
Copy Markdown
Member Author

@markshannon gentle ping :')

@kumaraditya303
kumaraditya303 enabled auto-merge (squash) May 8, 2026 11:05
@kumaraditya303
kumaraditya303 merged commit d2d24e4 into python:main May 8, 2026
52 checks passed
@NekoAsakura
NekoAsakura deleted the gh-100239/expose-sq-repeat-helpers branch May 8, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants