| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…ION_VERSION_INLINE Signed-off-by: Manjusaka <me@manjusaka.me>
Signed-off-by: Manjusaka <me@manjusaka.me>
…ka/method-version
Signed-off-by: Manjusaka <me@manjusaka.me>
Signed-off-by: Manjusaka <me@manjusaka.me>
There was a problem hiding this comment.
Very cool, thanks! A few suggestions:
Sorry, something went wrong.
| class TestObject: | ||
| def test(self, *args, **kwargs): | ||
| return args[0] | ||
|
|
||
| test_object = TestObject() | ||
| test_bound_method = TestObject.test.__get__(test_object) | ||
|
|
There was a problem hiding this comment.
Can you move this into test_method_guards_removed_or_reduced? global_identity needs to be at module scope for other reasons that don't apply here.
Also, I think it can be simplified to something like:
class TestObject:
def test(self, arg):
return arg
test_bound_method = TestObject().test
Sorry, something went wrong.
There was a problem hiding this comment.
If I'm correct, TestObject().test will just generate _CHECK_FUNCTION_VERSION code, It's a normal function.
Reference the test code here
Sorry, something went wrong.
There was a problem hiding this comment.
Can you move this into test_method_guards_removed_or_reduced? global_identity needs to be at module scope for other reasons that don't apply here.
BTW, if I push the test object into the test_method_guards_removed_or_reduced. I think the method will not be treated by a const. So we the _CHECK_FUNCTION_VERSION_INLINE is not exist in final opcode.
Sorry, something went wrong.
There was a problem hiding this comment.
@Zheaoli is right here. Can you please move this back to global scope? It seems tests are failing as the global method is not being promoted to a constant.
Sorry, something went wrong.
There was a problem hiding this comment.
Can you please move this back to global scope? It seems tests are failing as the global method is not being promoted to a constant.
Sure
Sorry, something went wrong.
…e-131798.JQRFvR.rst Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
Signed-off-by: Manjusaka <me@manjusaka.me>
Signed-off-by: Manjusaka <me@manjusaka.me>
There was a problem hiding this comment.
Sorry for forgetting to review this. This looks like a good optimization --- _CHECK_FUNCTION_VERSION_INLINE has one fewer memory indirection than _CHECK_METHOD_VERSION
Sorry, something went wrong.
|
@brandtbucher I update some idea about the test, PTAL when you got time. |
Sorry, something went wrong.
…ION_VERSION_INLINE (pythonGH-135022) Signed-off-by: Manjusaka <me@manjusaka.me> Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
…ION_VERSION_INLINE (pythonGH-135022) Signed-off-by: Manjusaka <me@manjusaka.me> Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
…ION_VERSION_INLINE (pythonGH-135022) Signed-off-by: Manjusaka <me@manjusaka.me> Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
…ION_VERSION_INLINE (pythonGH-135022) Signed-off-by: Manjusaka <me@manjusaka.me> Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.