-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
bpo-37774: use Py_LIKELY/Py_UNLIKELY for vectorcall #15144
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
Conversation
Include/pymacro.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think __GNUC__ > 2 is redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant because Python won't compile with GCC 2.x anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because:
- I don't know GCC 2.x supports all of C99 features we use in PEP 7.
- I don't know how to use GCC 2 to compile Python in recent days.
- I don't know who try to compile Python with GCC 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this page: https://gcc.gnu.org/c99status.html
We use some GCC>=3.0 features already.
- designated initializers
- new block scopes for selection and iteration statements
- stdbool.h (GCC 2.95 had
<stdbool.h>, but based on an early draft with major differences from C99 semantics.)
pablogsal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not super fan of exposing these macros, by I agree with @methane in that they are battle tested. Do we have some benchmarks numbers for the effect of this (with PGO, as PGO also activates branch-prediction annotations)?
|
I don't think these macros are useful for PGO build. In case of obmalloc.c, it only affects non-PGO build. |
140acb8 to
7881bc9
Compare
|
Rebased to latest master, fixed conflicts in @markshannon: what's your opinion on this? It achieves the same speedup as #14735 but in a more structural way. |
|
@markshannon do you have time for a review of this PR? Thank you |
|
This has three approvals - should it be merged once the conflicts are resolved? |
|
As @methane has said, given PGO does this for us, what's the point? Having said that. I'd be OK with https://github.com/python/cpython/pull/15144/files#diff-7f17c8d8448b7b6f90549035d2147a9fR4978 being added, as performance is deliberately being sacrificed when As for the others, probably not. |
markshannon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no benefit to this.
I'd rather leave this sort of tweaking to tools as they can adapt as the surrounding code changes.
|
@jdemeyer do you mind if I close this? |
|
This is rather out of date now, so I'm closing it. |
|
Closing as there are conflicts and the benefit is unclear. |
CC @markshannon @methane
https://bugs.python.org/issue37774