August 7, 2003

Waste 'o time

I just spent the last two days working on a utility that turns out to be worthless. Some of our code was allocating a block of memory and deleting it soon after. Since the code was going to be called multiple times I figured that it'd be smart to reuse a buffer.

I did some tests of reusing a buffer vs. malloc/new. Reusing the buffer was an order of magnitude faster. Great. So I spent a few days creating a factory that would reuse arbitrary lengthed buffers.

I ran some tests today and it was dog slow compared to malloc/new. I am pretty sure the overhead of the factory and the function calls are too much and can't compete.

I'm sure other people already knew this, but I had to waste work time figuring it out. It sucks because I had touted this factory idea as a huge speed up - like 10x - and it wasn't.

Posted by Sam at August 7, 2003 10:59 AM
Comments
Post a comment









Remember personal info?