Patch available now... More details inline One very interesting development is that we have 2 bytes of wasted space we can potentially use in the 'item' structure due to alignment padding.
I also have a patch that uses the unlikely() macro for access to settings.verbose. The generated assembler does show better branch choices. On Sat, Dec 26, 2009 at 4:11 AM, Trond Norbye <[email protected]>wrote: > >> After moving around elements of the structures I found there are some >> savings that can be achieved. Here's a diff of original vs optimized size: >> >> size of struct slab_stats = 56 >> -size of struct stats = 160 >> -size of struct settings = 112 >> +size of struct stats = 152 >> +size of struct settings = 96 >> >> > We have just one instance of the setting struct and and a small amount of > the stats structs, so I would rather organize the variables in a natural way > there (I haven't checked if that's the case currently). > These structures are pretty free-form. I was able to move things around without too much disruption. Whenever these structs change it will be wise to compile on a 64 bit system with -Wpadded to see where the wasted bytes are. > > >> size of item = 48 >> -size of conn = 496 >> +size of conn = 464 >> >> >> > A normal memcached instance may have thousands of these structures, so we > may save space here.. > > Here the struct has more 'structure', so I was careful to only move a few items around. I was still able to get it down to 464 bytes -- a 32 byte savings. Again, structure changes should be done with care and -Wpadded
