Is there any perf hit using DLL functions?
As the title says, compared to a normal function, is there a perf hit in calling dll functions? The dll will be loaded by dlopen
.
EDIT:
Ignore dlsym
time 开发者_StackOverflow社区because I only do it once per each function.
Calls to DLL functions are indirect by address and the compiler can't inline them, so there is a slight performance hit.
You should only worry if you use them in a performance critical inner loop and after profiling them.
Yes there is a performance hit. You do a dlsym call to get the function's address and then call the function with that address. As there is an added dlsym call compared to a function call from the same module, it must be slower. How much that matters? It depends. The only sure way to know is to measure it.
The best way to find out is simply to measure...
精彩评论