Checking the number of parameters of the "outputtypehandler" function can be very slow. #433
abdeljalilchehaibou
started this conversation in
General
Replies: 2 comments 1 reply
-
Thanks for sharing. |
Beta Was this translation helpful? Give feedback.
1 reply
-
The solution of using an indicator that the method accepts 2 arguments without checking is a good compromise, which allows to guarantee backward compatibility and to avoid this overhead. Thank you! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
_get_output_type_handler of class BaseCursorImpl uses the inspect.signature introspection method to check the number of parameters of the outputtypehandler.
This inspect.signature method is CPU intensive, taking up to 50% of cursor.execute execution time.
I suggest using "co_varnames" which is more CPU-friendly than inspect.signature:
Gives:
Here is a screenshot of a profiline showing the inspect.signature fingerprint on cursor.execute:
I propose this patch for python-oracledb for oracledb/impl/base/cursor.pyx:
Beta Was this translation helpful? Give feedback.
All reactions