-
Notifications
You must be signed in to change notification settings - Fork 214
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
KObj: avoid reflection #300
Comments
/help |
@serathius: GuidelinesPlease ensure that the issue body includes answers to the following questions:
For more details on the requirements of such an issue, please see here and ensure that they are met. If this request no longer meets these requirements, the label can be removed In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign |
Thanks @pohly for providing more context in the slack convo. Below are the benchmark results for existing/newer
Existing implementation:
Updated implementation:
|
This isn't entirely unexpected. Instead of avoiding a nil pointer access (current approach) the new approach is to let the access happen and then recover from it. That is expensive. But it may still be worthwhile if it makes the common case of not hitting a nil pointer faster. Can you post the results for the existing KObj benchmark, too? |
Results for existing implementation for nil pointer are already posted in the above comment. Below are the results with well-formed parameters for both the implementations. Existing implementation:
Updated Implementation:
|
So it's not faster for the well-formed calls either. Looks like the That leaves "more complete solution" as the only reason for using the second approach. Given that it has been shown to be slower, that IMHO isn't sufficient to change anything. |
Anything else you wanted me to take a look at. |
I think we can close this issue here. kubernetes/kubernetes#106945 is kind of related (also about performance). /close |
@pohly: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/kind feature
Describe the solution you'd like
klog/klog.go
Lines 1575 to 1577 in 84f3ebd
It also might be slower that simply calling the
Name
andNamespace
functions and handling any failure withrecover
, which is the approach taken in #299 for other user supplied objects.We should write a benchmark for this and then pick the faster approach.
/cc @serathius
The text was updated successfully, but these errors were encountered: