Where Does the Time Go?
Forenoon watch, 8 bells (12:19 pm)

Now that my MUD (which I've recently settled on the name ForeverMUD) is getting more stable, I thought I'd run some profiling tools on it. Valgrind is a very cool utility made to do this very thing.

When I first started developing, I wrote in a loop timer that keeps track of the longest processing time as well as the average loop time. After the introduction of a large (16,200 room) world map, the loop times jumped from 10-30 µsec to over 190,000 µsec—no bueno.

So last night I ran Valgrind and used kcachegrind to view the results, which showed me this:

Valgrind and kcachegrind results

Put simply, most of my time is spent manipulating mutexes. I'm going to have to rethink my design, because that's way too much time…

Leave a Comment »