tal: append the length property to the initial allocation.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 17 Dec 2012 03:23:25 +0000 (13:53 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 17 Dec 2012 03:23:25 +0000 (13:53 +1030)
commit4814c4c79cc00ba61f865075af9ca8f919f6f370
tree17209e7e1794347012522840abd87551c43c1c50
parent3710d28925e2960e1ee164df3b4ce920f0b27319
tal: append the length property to the initial allocation.

Since we never post-add a length property, we can save some cycles by
allocating it together with the object itself:

Before:
$ ./samba-allocs talloc.dump --tal
Tal time:                6058997-6215211(6102645)ns
Tal_free time:           4791112-4968964(4824814)ns
Single tal_free time:    3173647-3331584(3200183)ns
$ ./samba-allocs talloc.dump --tal-size
Virtual size = 9809920, RSS = 3952640

After:
$ ./samba-allocs talloc.dump --tal
Tal time:                5911994-6043808(5956914)ns
Tal_free time:           4676026-4834598(4719908)ns
Single tal_free time:    2888195-3067365(2922298)ns
$ ./samba-allocs talloc.dump --tal-size
Virtual size = 9809920, RSS = 3948544

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/tal/_info
ccan/tal/tal.c
ccan/tal/test/run-count.c