Re: Reduce pack-objects memory footprint?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Duy Nguyen <pclouds@xxxxxxxxx> wrote:
> which saves 12 bytes (or another 74 MB). 222 MB total is plenty of
> space to keep some file cache from being evicted.

Nice!  I can definitely benefit from lower memory usage when
packing.  Fwiw, I use pahole with other projects to help find
packing opportunities:

	git://git.kernel.org/pub/scm/devel/pahole/pahole.git

> @@ -14,11 +26,10 @@ struct object_entry {
>  	void *delta_data;	/* cached delta (uncompressed) */
>  	unsigned long delta_size;	/* delta data size (uncompressed) */
>  	unsigned long z_delta_size;	/* delta data size (compressed) */
> -	enum object_type type;
> -	enum object_type in_pack_type;	/* could be delta */
>  	uint32_t hash;			/* name hint hash */
> -	unsigned int in_pack_pos;
>  	unsigned char in_pack_header_size;
> +	unsigned type:3;	 /* enum object_type */
> +	unsigned in_pack_type:3; /* enum object_type - could be delta */

For C99 compilers, enums can be bitfields.  I introduced the
following macro into Ruby a few weeks ago to remain compatible
with non-C99 compilers:

/*
 * For declaring bitfields out of non-unsigned int types:
 *   struct date {
 *      BITFIELD(enum months) month:4;
 *      ...
 *   };
 */
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
# define BITFIELD(type) type
#else
# define BITFIELD(type) unsigned int
#endif



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux