Page 1 of 1

MCH3: CheckHooks performance issue

Posted: Tue Sep 13, 2016 11:49 am
by EaSy
Hi,
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 (hMod)
			FreeLibrary(hMod);

		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)?

Thx

PP

EDIT: changed MCH version to .13

Re: MCH3: CheckHooks performance issue

Posted: Wed Sep 14, 2016 12:58 pm
by madshi
Updating to 3.1.13 did not improve the situation?

When you say "This app loads wldp.dll a few thousand times" does that mean the dll is loaded *and* unloaded a few thousand times? Or is it just loaded once and the load counter increased to a couple thousand times?

Re: MCH3: CheckHooks performance issue

Posted: Thu Sep 15, 2016 5:39 am
by EaSy
Nope, 3.1.13 did not change a thing. It is still slow.

Yes, I mean LoadLibrary and FreeLibrary. The same way as the test sample does. The usecase is without MCH the app loads for about 1minute, but with MCH it loads for about 3 and half minutes.

Re: MCH3: CheckHooks performance issue

Posted: Wed Sep 21, 2016 5:00 am
by EaSy
Hi, any progress?

PP

Re: MCH3: CheckHooks performance issue

Posted: Mon Sep 26, 2016 10:36 am
by madshi
I'm sorry for taking so long. I'm currently working on some stability issues reported by users, which are somewhat more important than performance issues. I should get to this performance problem some time this week, though.

Re: MCH3: CheckHooks performance issue

Posted: Tue Sep 27, 2016 12:38 pm
by EaSy
Great,
thx.

PP

Re: MCH3: CheckHooks performance issue

Posted: Mon Oct 03, 2016 5:25 am
by EaSy
Hi, any progress?

PP

Re: MCH3: CheckHooks performance issue

Posted: Thu Oct 13, 2016 3:11 pm
by EaSy
Hi, any progress?

PP

Re: MCH3: CheckHooks performance issue

Posted: Wed Oct 19, 2016 6:48 am
by EaSy
Hi, any progress? :confused:

PP

Re: MCH3: CheckHooks performance issue

Posted: Wed Oct 19, 2016 2:31 pm
by madshi
I'm sorry for taking so long. I'm hoping to get a look at this in the next 2 days.

Re: MCH3: CheckHooks performance issue

Posted: Thu Oct 27, 2016 5:51 pm
by madshi
Here's a test build with some CheckHooks performance improvements. Hope the speed up is sufficient for you?

http://madshi.net/madCollectionBeta.exe (installer 2.8.0.7)

I've implemented the changes in both v3 and v4.

Re: MCH3: CheckHooks performance issue

Posted: Thu Nov 03, 2016 3:37 pm
by EaSy
It works! Thx.

pp

Re: MCH3: CheckHooks performance issue

Posted: Thu Nov 03, 2016 3:40 pm
by madshi
Glad to hear that!