8000 [3.12] gh-112919: Speed-up datetime, date and time.replace() (GH-112921) by eltoder · Pull Request #115344 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.12] gh-112919: Speed-up datetime, date and time.replace() (GH-112921) #115344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

eltoder
Copy link
Contributor
@eltoder eltoder commented Feb 12, 2024

Use argument clinic and call new_* functions directly. This speeds up
these functions 6x to 7.5x when calling with keyword arguments.
(cherry picked from commit 1f515e8)

Co-authored-by: Eugene Toder eltoder@users.noreply.github.com

eltoder and others added 2 commits February 10, 2024 01:35
…-112921)

Use argument clinic and call new_* functions directly. This speeds up
these functions 6x to 7.5x when calling with keyword arguments.

(cherry picked from commit 1f515e8)
…ythonGH-112921)

Use argument clinic and call new_* functions directly. This speeds up
these functions 6x to 7.5x when calling with keyword arguments.
(cherry picked from commit 1f515e8)

Co-authored-by: Eugene Toder <eltoder@users.noreply.github.com>
@eltoder
Copy link
Contributor Author
eltoder commented Feb 13, 2024

Hi @Yhg1s,

This PR is a backport from main. It's a simple change that gives a nice speedup, but the main goal is to make the backport of the bug-fix #114780 easier. If we backport this, the change for #114780 should apply cleanly without manual edits. This PR fails the ABI change check in CI, but it seems to be a false positive. (It just adds a few string constants.) @ericsnowcurrently says that this is OK to do in bugfix releases, but the decision is up to you.

Please let me know if we can backport this change or if I should write a separate version of #114780 for 3.12.

Thank you.

@hugovk
Copy link
Member
hugovk commented Aug 12, 2024

"Check if the ABI has changed" is failing on the CI:

1 Changed variable:

  [C] '_PyRuntimeState _PyRuntime' was changed at pycore_runtime.h:192:1:
    size of symbol changed from 459992 to 460384

Generated ABI file is not up to date.
Please add the release manager of this branch as a reviewer of this PR.

The up to date ABI file should be attached to this build as an artifact.

To learn more about this check: https://devguide.python.org/setup/#regenerate-the-abi-dump

Error: Process completed with exit code 1.

@hugovk hugovk added the pending The issue will be closed if no feedback is provided label Feb 17, 2025
@terryjreedy
Copy link
Member

@hugovk I am curious what is pending? The generated file has 7 conflicts like


<<<<<<< backport-1f515e8-3.12
    _PyUnicode_InternInPlace(interp, &string);
    string = &_Py_ID(day);
    assert(_PyUnicode_CheckConsistency(string, 1));
    _PyUnicode_InternInPlace(interp, &string);
=======
    assert(PyUnicode_GET_LENGTH(string) != 1);
>>>>>>> 3.12

These seem easy enough to fix (keep backport?) and I could do that, but I assumed that generated files are not checked in.

@hugovk
Copy link
Member
hugovk commented Feb 24, 2025

Most generated files are not checked in, but a handful are.

Several things pending:

  • @Yhg1s to decide whether this can be backported to 3.12
  • Merge conflict needs fixing
  • Generated ABI file needs updating

@ambv
Copy link
Contributor
ambv commented Apr 8, 2025

3.12 is entering security-only fixes mode today. Seems to me like this performance fix shouldn't go to 3.12 anyway.

@ambv ambv closed this Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review pending The issue will be closed if no feedback is provided
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0