faster malloc

Post tutorials on how to do certain tasks within game or engine code here.
Post Reply
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

faster malloc

Post by revelator »

utility library thats seen used in more and more engines nowadays.

look up my ftp ip in general in the mingw compiler thread and grab this nedmalloc.7z if you want to try it out.

upto 125% faster than msvc malloc.

uses the same methods as dlmalloc.

to use in your own engine add nedmalloc.h at the start of quakedef.h

then add this to the compiler defines REPLACE_SYSTEM_ALLOCATOR

and add nedmalloc.lib to libraries.
dreadlorde
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am
Contact:

Post by dreadlorde »

Ehh, include files shouldn't include other include files. It creates a dependency hell situation, and can make the c preprocessor take longer than necessary, as it would process the same header more than needed.

My 2 cents about that.
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.
Get off my lawn!
revelator
Posts: 2621
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Post by revelator »

actually for most purposes and intents thats what headers do "besides holding structs etc"

if the idea disgust you that much you can also include the nedmalloc.h header in any file that uses a malloc function but as you might soon discover that includes allmost 90% of the engine :lol:

quakedef.h is included by pretty much all the files in quake so if you put it there it will be globally accessible :) sort of a win-win situation.

btw the normal way of including nedmalloc is by including its source in whatever project you want to use it on. i just made it a library for convinience.
dreadlorde
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am
Contact:

Post by dreadlorde »

reckless wrote: if the idea disgust you that much you can also include the nedmalloc.h header in any file that uses a malloc function but as you might soon discover that includes allmost 90% of the engine :lol:
That's what I'm doing with my engine right now, I'm fixing all of the included include files... It's PITA. :lol:
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.
Get off my lawn!
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Post by mh »

dreadlorde wrote:Ehh, include files shouldn't include other include files. It creates a dependency hell situation, and can make the c preprocessor take longer than necessary, as it would process the same header more than needed.

My 2 cents about that.
Well best of luck with GNU stdlib.h then!
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
dreadlorde
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am
Contact:

Post by dreadlorde »

mh wrote: Well best of luck with GNU stdlib.h then!
Gahhh, don't remind me..

I may use lunix (I use windows 7 too), but that doesn't mean I like the crap gnu pushes out, or lunix for that matter..
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.
Get off my lawn!
Post Reply