we are facing a huge performance hit caused by MCH. Our customer reports massive 350% slowdown when listing some of the data inside one of their private app. This app loads wldp.dll a few thousand times.
We traced the issue and it points into MCH CheckHooks. We are hooking about 100 windows APIs. We are using MCH v3.1.13.
I wrote a simple test app looking like this:
- Code: Select all
DWORD dwTickCount = GetTickCount();
for (int i = 0; i < 10000; ++i)
HMODULE hMod = LoadLibraryW(L"wldp.dll");
if (i % 100 == 0)
printf("%u: %u\n", i, GetTickCount() - dwTickCount);
When this test app is not injected by our DLL it runs for about 5 seconds, but hen this app is injected it runs for about 20 seconds. It is huge performance hit.
Is there a way to lower the amout the CheckHooks fcn is called (it is called on every load/unload) or the lower the time the CheckHooks fcn consume (it always enumerates all the hooks)?
EDIT: changed MCH version to .13