[PATCH 2 of 2] osutil.c: replace alloca() with malloc() and remove <alloca.h>
Giorgos Keramidas
keramida at ceid.upatras.gr
Mon Oct 8 00:27:13 UTC 2007
On 2007-10-08 01:26, Michael Gebetsroither <gebi at sbox.tugraz.at> wrote:
>* Giorgos Keramidas <keramida at ceid.upatras.gr> wrote:
>> Not really, how should I go about testing that this is not a performance
>> regression? I ssuspect there's going to be a minor overhead because of
>> an extra function call for the free() I added, but it would be nice to
>> be able to produce useful performance test results.
>
> 2 functioncalls overhead ;).
> alloca is mostly translated to only one instruction simply adjusting
> the stack pointer.
The tricky part is how we quantify `mostly' here.
I'm not really suggesting that we should *go* with malloc(), since I've
discovered since the firstpatch was submitted that Mercurial can build
again on FreeBSD by including <stdlib.h> instead of <alloca.h>, but it
_is_ interesting if optimizing this particular malloc() call with
alloca() makes a difference :)
More information about the Mercurial-devel
mailing list