[Gc] Improving perfs on a multi CPU windows system

Emmanuel Stapf [ES] manus@eiffel.com
Wed, 27 Aug 2003 12:40:30 -0700

Instead of using InitializeCriticalSection, we should be using
InitializeCriticalSectionAndSpinCount. I've set it up to have a spin count of 4000
(the same value as Microsoft said it is using for the heap critical section) and a
system went from a total time of 1min to 32s. It is a huge improvement.

The only issue is that it works with only the following systems:
Included in Windows XP, Windows 2000 Professional, Windows NT Workstation 4.0 SP3
and later, Windows Me, and Windows 98.

So I'm not sure if it should be integrated, but at least we could have in the GC

#if (_WIN32_WINNT >= 0x0403)
InitializeCriticalSectionAndSpinCount (cs, 4000)
InitializeCriticalSection (cs);

That way it is up to the guy who compiles the code to decide which platforms he is