Skip to content
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

gh-88473: Implement fast path in date.today() for date types #130980

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

StanFromIreland
Copy link
Contributor

@StanFromIreland StanFromIreland commented Mar 8, 2025

Other suggested implementations are not as backward compatible.

$ ./python -m timeit -s 'from datetime import date' 'date.today()'
1000000 loops, best of 5: 271 nsec per loop
$ python3.14 -m timeit -s 'from datetime import date' 'date.today()'
200000 loops, best of 5: 1.36 usec per loop

~5x faster for date types

@picnixz
Copy link
Member

picnixz commented Mar 8, 2025

Are the benchmarks realised on a PGO build or a debug build? or maybe PGO+LTO? or just release build?

@StanFromIreland
Copy link
Contributor Author

Both are just plain builds. python3.14 is from the morning but I doubt the few commits matter.

@picnixz
Copy link
Member

picnixz commented Mar 8, 2025

By plain builds, do you mean with or withou --with-pydebug? I assume without so it's probably release builds so it should be fine. But please the configure flags

@StanFromIreland StanFromIreland requested a review from picnixz March 8, 2025 22:06
@StanFromIreland
Copy link
Contributor Author

@pganssle can you take a look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants