Compiling nedmalloc w/ DMC

zz zz at zz.com
Mon Jan 8 09:40:50 PST 2007


Craig Black wrote:
> I know some D users are interested in nedmalloc so I thought I would post
> this here as well as in the C++ newsgroup.  BTW, I am very impressed with
> nedmalloc.  In my C++ code, I gained an overall performance increase of
> about 15% by using it.
> 

Here is a dirty solution for compiling nedmalloc with DMC.

Inside winnt.h add the following:
typedef enum _HEAP_INFORMATION_CLASS {
	HeapCompatibilityInformation
} HEAP_INFORMATION_CLASS;

Inside winbase.h add the following:
WINBASEAPI BOOL WINAPI 
InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION,DWORD);


compile dmc -o -DNDEBUG -DWIN32 -D_WIN32_WINNT=0x0501 test.c

I commented out the if(0) and if(1) in test.c just for my test.
And here are my results.

Standard DMC allocator:  624583.696090 ops/sec under 2 threads.
Nedmalloc allocator:    3109062.452439 ops/sec under 2 threads.

Nedmalloc is 4.977816 times faster than standard.

Zz





More information about the Digitalmars-d mailing list