Casting performance issues #4337
Unanswered
PascalBoeschoten
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm using pybind in some performance sensitive code and profiling show pybind hammering two casting-related functions pretty hard,
get_type_infoandtry_load_foreign_module_local:pybind11/include/pybind11/detail/type_caster_base.h
Line 216 in 296615a
pybind11/include/pybind11/detail/type_caster_base.h
Line 652 in 296615a
While
try_load_foreign_module_localtakes up a significant amount of runtime it always ends up returningfalseat the first branch. Is this indicating some issue in my code? Would it be risky to remove/disable this function? (E.g. replacing the implementation with just areturn false)For
get_type_infoI think in my situation this function could really benefit from a small cache since the hot code tends to use a small number of types repeatedly. Is there a safety/correctness reason why this function doesn't cache already?Beta Was this translation helpful? Give feedback.
All reactions