]> git.ipfire.org Git - thirdparty/git.git/commit - unpack-trees.c
unpack-trees: reduce malloc in cache-tree walk
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sat, 18 Aug 2018 14:41:25 +0000 (16:41 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sat, 18 Aug 2018 16:47:46 +0000 (09:47 -0700)
commitf1e11c6510846321574e0ad9443843d7ba3eb758
tree36df1345e4cdfbd82cbe7f5f26aeed9390b86f9e
parentb4da37380b7774248086f42bcd59397a44e1ac79
unpack-trees: reduce malloc in cache-tree walk

This is a micro optimization that probably only shines on repos with
deep directory structure. Instead of allocating and freeing a new
cache_entry in every iteration, we reuse the last one and only update
the parts that are new each iteration.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
unpack-trees.c