See: http://blogs.testbit.eu/timj/2005/12/02/02122005-landing-g_slice_new/ (page moved)
I finally managed to finish up the new g_slice_*() allocator for GLib CVS and commit it. For most platforms, it should be a lot faster than malloc(), and on my machine it saves 20-30% in performance over allocating with mem-chunks. But most importantly, it does share equally sized chunks across a program, which mem-chunks didn’t, so they opened up several independent heaps of equally sized chunks, scattered all over the program and causing large wastage.
I would like to thank Matthias Clasen for an initial version of the magazine cache and Stefan Westerfeld for helping me with optimizing the common code paths.
2 Comments
Are there any real-world situations where this will result in a noticable performance increase? I’m thinking of things like startup/shutdown of application X, displaying a really large directory in nautilus, showing the open dialog and other actions that currently take far to long.
Those results are brilliant :) I’d guess this would be an ideal allocator to use for allocating private object data, which should see app startup time implications. Are there any plans to use this in g_object_new?