Skip to content

Clarify that performance improvements are not backported#1826

Open
gaborbernat wants to merge 4 commits into
python:mainfrom
gaborbernat:perf-no-backport
Open

Clarify that performance improvements are not backported#1826
gaborbernat wants to merge 4 commits into
python:mainfrom
gaborbernat:perf-no-backport

Conversation

@gaborbernat
Copy link
Copy Markdown

A contributor recently proposed backporting a performance improvement to the maintenance branches, and the question surfaced that the devguide does not say whether optimizations should be backported. Core developers confirmed the long-standing practice in the linked discussion: optimizations are not backported, because an optimization can introduce a regression and a regression in a bugfix release is costly to track down and undo.

This adds that rule to the maintenance-branch section of the development cycle, next to the existing "bug fixes, test improvements, and documentation" guidance, and spells out the narrow exception a few core developers noted: a change that is a clear win, carries no regression risk (including for code that subclasses or monkey-patches internals), and matters enough to applications to justify it, discussed first.

Discussion: https://discuss.python.org/t/performance-improvements-and-backports/107625

A contributor proposed backporting a performance improvement to the
maintenance branches, which prompted core developers to restate the
long-standing practice: optimizations are not backported. An optimization can
introduce a regression, and a regression in a bugfix release is costly to find
and undo.

Add this to the maintenance-branch rules so the expectation is explicit, and
describe the narrow exception (a clear, no-risk, high-impact change agreed in
discussion).

Discussion: https://discuss.python.org/t/performance-improvements-and-backports/107625
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented Jun 5, 2026

Documentation build overview

📚 CPython devguide | 🛠️ Build #33009030 | 📁 Comparing 19ac73f against latest (aeb99bd)

  🔍 Preview build  

2 files changed
± versions/index.html
± developer-workflow/development-cycle/index.html

Comment thread developer-workflow/development-cycle.rst Outdated
Sergey noted the maintenance-branch sentence already reads clearly, so a
separate paragraph restates it. Move the performance point into that sentence as
one clause and let the existing "rare exceptions ... must be discussed first"
line cover the narrow case.
@hugovk hugovk changed the title 📝 docs: clarify that performance improvements are not backported Clarify that performance improvements are not backported Jun 5, 2026

The only changes allowed to occur in a maintenance branch without debate are
bug fixes, test improvements, and edits to the documentation.
bug fixes, test improvements, and edits to the documentation. Performance
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.

I don't really get why "performance improvements" are special here, they are features, and we already explicitly state (albeit elsewhere):

The only branch that receives new features is main, the in-development branch.

In this event, I think everything generally went according to the docs: can't backport features "without debate," however exceptions can be made, provided you open a discussion first.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

If we all agree I can withraw this PR, but I think there's benefit of having this here, as would have saved that discussion thread and initial confusion by someone else.

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.

I don't think it's obvious that performance improvements are "features", so it's worth clarifying.

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.

This does not seem to be the place for explaining what features are.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Perhaps, we should cross link the "feature" explanation location then here? So people can click through and see how we define a feature.

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.

@StanFromIreland by the way I believe you wanted to link to https://devguide.python.org/developer-workflow/development-cycle/#in-development-main-branch not the committing part, right?

I quoted the section in committing.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Cross-linking is awkward because that section lists everything main takes, bug fixes included, and bug fixes are the one type that backports without debate. Pointing there to explain what needs discussion sends people to a list where one of the four entries is the opposite case.

I pushed a different fix: the maintenance section now splits changes into low-risk (bug fixes, tests, docs, backport freely) and higher-risk (new features, semantic changes, performance improvements, need a discussion and a strong case first). It names performance improvements directly, so the original confusion can't recur, and it never has to define what a feature is.

Copy link
Copy Markdown
Member

@StanFromIreland StanFromIreland Jun 5, 2026

Choose a reason for hiding this comment

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

I think this is going the wrong way, and complicating this paragraph. It's goal is to explain what we do and don't backport, not list all the kinds of features. IMO, the note in this paragraph should be something like:

New features should not be backported.

We note features in various places, they shouldn't all have to explain what exactly they are.

Copy link
Copy Markdown
Author

@gaborbernat gaborbernat Jun 5, 2026

Choose a reason for hiding this comment

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

I might be missing something but where do we define that performance improvement is a feature? I know you referenced earlier, but pointed to the opening PR section. The devguide.python.org/developer-workflow/development-cycle#in-development-main-branch specifically calls it out as a separate thing, not as a feature.

We note features in various places, they shouldn't all have to explain what exactly they are.

Explicit better than implicit, I think is better to repeat things (or at least cross link things) rather than let people assume from their knowledge from other locations.

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.

cross link things) rather than let people assume from their knowledge from other locations.

Yes, that's my idea from above:

I think we should clarify what features are and link here

Copy link
Copy Markdown
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

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.

5 participants