nedmalloc, again

Programming, for all ages and all languages.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: nedmalloc, again

Post by jal »

Mmmm, weirdness, recompiled today and it now runs. Doesn't give to much trust in nedmalloc :). "nedmalloc allocator is 1.402341 times faster than standard". Now time to plug in my own malloc...


JAL
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: nedmalloc, again

Post by JamesM »

Bump... results plz? 8)
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: nedmalloc, again

Post by jal »

Yeah, sorry, no results yet, been busy with other stuff. Maybe next week. Anyone else has any results?


JAL
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: nedmalloc, again

Post by Combuster »

I could plug PDClib's malloc, but knowing it is an inefficient alpha version it is guaranteed to lose big time. So I didn't bother.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: nedmalloc, again

Post by NickJohnson »

I'm working on my libc's malloc this week - I'll test it if I finish soon enough: it should work really well on lots of similar allocations. Where is the code for nedmalloc's benchmark suite?
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: nedmalloc, again

Post by jal »

NickJohnson wrote:Where is the code for nedmalloc's benchmark suite?
In the nedmalloc zip-file. It's just one Google away.


JAL
User avatar
quanganht
Member
Member
Posts: 301
Joined: Fri May 16, 2008 7:13 pm
Location: Hanoi, Vietnam

Re: nedmalloc, again

Post by quanganht »

Something's wrong here. I cannot compile test.c on Ubuntu x64
"Programmers are tools for converting caffeine into code."
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: nedmalloc, again

Post by jal »

quanganht wrote:Something's wrong here. I cannot compile test.c on Ubuntu x64
What errors do you get?


JAL
User avatar
quanganht
Member
Member
Posts: 301
Joined: Fri May 16, 2008 7:13 pm
Location: Hanoi, Vietnam

Re: nedmalloc, again

Post by quanganht »

jal wrote:
quanganht wrote:Something's wrong here. I cannot compile test.c on Ubuntu x64
What errors do you get?


JAL
Like this

Code: Select all

In file included from nedmalloc.c:63,
                 from test.c:8:
malloc.c.h: In function ‘mmap_resize’:
malloc.c.h:3704: warning: cast to pointer from integer of different size
malloc.c.h: In function ‘sys_trim’:
malloc.c.h:4137: warning: comparison between pointer and integer
/tmp/cc3lTAIT.o: In function `AllocCache':
test.c:(.text+0x8ad7): undefined reference to `pthread_setspecific'
/tmp/cc3lTAIT.o: In function `InitPool':
test.c:(.text+0x913a): undefined reference to `pthread_key_create'
test.c:(.text+0x9293): undefined reference to `pthread_key_delete'
/tmp/cc3lTAIT.o: In function `FindMSpace':
test.c:(.text+0x9acd): undefined reference to `pthread_setspecific'
/tmp/cc3lTAIT.o: In function `neddestroypool':
test.c:(.text+0x9d1b): undefined reference to `pthread_key_delete'
/tmp/cc3lTAIT.o: In function `neddisablethreadcache':
test.c:(.text+0x9f49): undefined reference to `pthread_getspecific'
test.c:(.text+0x9f6a): undefined reference to `pthread_setspecific'
test.c:(.text+0xa0d3): undefined reference to `pthread_setspecific'
/tmp/cc3lTAIT.o: In function `nedpmalloc':
test.c:(.text+0xa21d): undefined reference to `pthread_getspecific'
test.c:(.text+0xa29c): undefined reference to `pthread_setspecific'
/tmp/cc3lTAIT.o: In function `nedpcalloc':
test.c:(.text+0xa62d): undefined reference to `pthread_getspecific'
test.c:(.text+0xa6ac): undefined reference to `pthread_setspecific'
/tmp/cc3lTAIT.o: In function `nedprealloc':
test.c:(.text+0xaa52): undefined reference to `pthread_getspecific'
test.c:(.text+0xaad1): undefined reference to `pthread_setspecific'
/tmp/cc3lTAIT.o: In function `nedpfree':
test.c:(.text+0xacd3): undefined reference to `pthread_getspecific'
test.c:(.text+0xad52): undefined reference to `pthread_setspecific'
/tmp/cc3lTAIT.o: In function `nedpmemalign':
test.c:(.text+0xaedc): undefined reference to `pthread_getspecific'
test.c:(.text+0xaf5b): undefined reference to `pthread_setspecific'
/tmp/cc3lTAIT.o: In function `nedpindependent_calloc':
test.c:(.text+0xb604): undefined reference to `pthread_getspecific'
test.c:(.text+0xb683): undefined reference to `pthread_setspecific'
/tmp/cc3lTAIT.o: In function `nedpindependent_comalloc':
test.c:(.text+0xba70): undefined reference to `pthread_getspecific'
test.c:(.text+0xbaef): undefined reference to `pthread_setspecific'
/tmp/cc3lTAIT.o: In function `runtest':
test.c:(.text+0xc287): undefined reference to `pthread_create'
test.c:(.text+0xc304): undefined reference to `pthread_join'
test.c:(.text+0xc343): undefined reference to `pthread_create'
test.c:(.text+0xc388): undefined reference to `pthread_join'
collect2: ld returned 1 exit status
Sorry for slow responding, f**king Spamhaus blocked me :x
"Programmers are tools for converting caffeine into code."
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: nedmalloc, again

Post by Combuster »

That is not a compilation error.

Ever tried linking to the correct libraries? (read: -lpthread)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
quanganht
Member
Member
Posts: 301
Joined: Fri May 16, 2008 7:13 pm
Location: Hanoi, Vietnam

Re: nedmalloc, again

Post by quanganht »

Got it. 10 threads under Ubuntu 9.10 running x86-64 Core 2 Duo. This is what I have

Code: Select all

nedmalloc allocator is 0.508529 times faster than standard
WTF is it anyway ?!? Linux malloc out performed ned's ? :shock:

EDIT: With 5 threads:

Code: Select all

nedmalloc allocator is 0.711086 times faster than standard
EDIT2: I think I have gone mad to do this:

Code: Select all

20 threads:
nedmalloc allocator is 0.316950 times faster than standard

50 threads:
nedmalloc allocator is 0.171097 times faster than standard

100 threads:
nedmalloc allocator is 0.091263 times faster than standard

100 threads with -O3:
nedmalloc allocator is 0.076826 times faster than standard
The nedmalloc has a huge delay before it fire up, especially with more and more threads.
"Programmers are tools for converting caffeine into code."
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: nedmalloc, again

Post by jal »

Combuster wrote:(read: -lpthread)
Or just plain -pthread.


JAL
xyzzy
Member
Member
Posts: 391
Joined: Wed Jul 25, 2007 8:45 am
Libera.chat IRC: aejsmith
Location: London, UK
Contact:

Re: nedmalloc, again

Post by xyzzy »

In testing against my allocator I found that the latest released version of nedmalloc performs pretty badly. After switching to nedmalloc SVN (revision 1130 - latest was broken for me), it started performing much better.
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: nedmalloc, again

Post by NickJohnson »

I finally finished my allocator, and ported it to Linux. It's only single threaded, so all of these tests are with only 1 thread. It's all with "-O2 -fomit-frame-pointer -march=native" under gcc 4.3.4 and glibc 2.3.7. (glibc was compiled with "-O2 -fomit-frame-pointer -march=native" for fairness)

I changed the output format for the benchmark to just output the speed of each allocator, so I could compare them all at once. Here are the results:

Code: Select all

standard: 1960572 ops/sec
nedmalloc: 2784614 ops/sec
abmalloc: 2329786 ops/sec
Clearly, for single threads, nedmalloc > abmalloc (my malloc) > glibc's malloc, although it seems like nedmalloc scales badly from other results. If I set it to not allocate the larger blocks, and only the power-of-2 <512 byte chunks it says are typical of C++ allocations, the results are quite different:

Code: Select all

standard: 2245848 ops/sec
nedmalloc: 3269323 ops/sec
abmalloc: 4247631 ops/sec
I specifically designed my allocator for small allocations, so it isn't very surprising that it's twice as fast as glibc's malloc for them. :mrgreen:

Does anyone else have results?
Post Reply