]> git.ipfire.org Git - thirdparty/git.git/commit
Reduce memory usage of fast-import.
authorShawn O. Pearce <spearce@spearce.org>
Mon, 5 Feb 2007 21:34:56 +0000 (16:34 -0500)
committerShawn O. Pearce <spearce@spearce.org>
Mon, 5 Feb 2007 21:34:56 +0000 (16:34 -0500)
commit10831c551323121bdab06c3eaf2f52c6658fd6b8
tree10b3dc24b257792a0097b5715162a6a40f598fa9
parent8c1f22da9f8124dfabb5da8476845250b5c35ae8
Reduce memory usage of fast-import.

Some structs are allocated rather frequently, but were using integer
types which were far larger than required to actually store their
full value range.

As packfiles are limited to 4 GiB we don't need more than 32 bits to
store the offset of an object within that packfile, an `unsigned long`
on a 64 bit system is likely a 64 bit unsigned value.  Saving 4 bytes
per object on a 64 bit system can add up fast on any sizable import.

As atom strings are strictly single components in a path name these
are probably limited to just 255 bytes by the underlying OS.  Going
to that short of a string is probably too restrictive, but certainly
`unsigned int` is far too large for their lengths.  `unsigned short`
is a reasonable limit.

Modes within a tree really only need two bytes to store their whole
value; using `unsigned int` here is vast overkill.  Saving 4 bytes
per file entry in an active branch can add up quickly on a project
with a large number of files.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
fast-import.c