• J
    fast-import: grow tree storage more aggressively · f022f85f
    Jeff King 提交于
    When building up a tree for a commit, fast-import
    dynamically allocates memory for the tree entries. When more
    space is needed, the allocated memory is increased by a
    constant amount. For very large trees, this means
    re-allocating and memcpy()ing the memory O(n) times.
    
    To compound this problem, releasing the previous tree
    resource does not free the memory; it is kept in a pool
    for future trees. This means that each of the O(n)
    allocations will consume increasing amounts of memory,
    giving O(n^2) memory consumption.
    Signed-off-by: NJeff King <peff@peff.net>
    Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
    f022f85f
fast-import.c 50.7 KB