Skip to content

[mypyc] Refactor: use helper functions for vec growth#21361

Merged
JukkaL merged 2 commits intomasterfrom
vec-growth
Apr 29, 2026
Merged

[mypyc] Refactor: use helper functions for vec growth#21361
JukkaL merged 2 commits intomasterfrom
vec-growth

Conversation

@JukkaL
Copy link
Copy Markdown
Collaborator

@JukkaL JukkaL commented Apr 28, 2026

This way we can centrally manage the logic used to increase vec sizes during growth.

This way we can centrally manage the logic used to increase vec
sizes during growth.
Comment thread mypyc/lib-rt/vecs/librt_vecs.h Outdated
// Growth helpers

static inline Py_ssize_t Vec_GrowCapacity(Py_ssize_t cap) {
if (cap > (PY_SSIZE_T_MAX - 1) / 2) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe put unlikely() here and below?

@JukkaL JukkaL merged commit e2a9691 into master Apr 29, 2026
17 checks passed
@JukkaL JukkaL deleted the vec-growth branch April 29, 2026 13:57
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.

3 participants