-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
Specialize long tail of binary operations using a table. #100239
Comments
#128722 broke repeated runs of Is it possible to fix this today? |
I'll take care of it! |
…ND` (#128963) Co-authored-by: Tomas R. <[email protected]> Co-authored-by: Irit Katriel <[email protected]>
…P_EXTEND` (python#128963) Co-authored-by: Tomas R. <[email protected]> Co-authored-by: Irit Katriel <[email protected]>
There is a desire to specialize the remaining binary operations (including binary subscript).
However adding more and more specialized instructions is likely to make performance worse.
This idea is to have a lookup table of types pairs and function pointers. This is less efficient than inlining the code, but more extensible.
A single instruction can then support up to 256 specializations.
This will only work for immutable classes.
An ancillary mapping of
(left, right) -> index
will be needed for efficient specialization.It is probably worth keeping the most common operations
int + int
,float + float
, etc. inline.We can replace
BINARY_SUBSCR
withBINARY_OP ([])
to allow effective specialization ofBINARY_SUBSCR
E.g. subscripting
array.array[int]
can be handled with the registration mechanism described below.Registering binary functions at runtime
faster-cpython/ideas#162
Linked PRs
The text was updated successfully, but these errors were encountered: