Skip to contentSkip to conversation

Avoid unnecessarily inflating and interpreting delta

PATCH New Junio C Hamano 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Avoid unnecessarily inflating and interpreting delta

This teaches packed_delta_info() that it only needs to look at the type of the base object to figure out both type and size of a deltified object. This saves quite a many calls to inflate() when dealing with a deep delta chain.

---

 cat-file.c  |    3 ++
 sha1_file.c |   77 +++++++++++++++++++++++++++++++----------------------------
 2 files changed, 43 insertions(+), 37 deletions(-)

f0792cd64bd42cde6706dc2c039e7b6901547169

cat-file.c +2 -1
@@ -16,7 +16,8 @@ int main(int argc, char **argv)
 		usage("git-cat-file [-t | -s | tagname] <sha1>");
 
 	if (!strcmp("-t", argv[1]) || !strcmp("-s", argv[1])) {
-		if (!sha1_object_info(sha1, type, &size)) {
+		if (!sha1_object_info(sha1, type,
+				      argv[1][1] == 's' ? &size : NULL)) {
 			switch (argv[1][1]) {
 			case 't':
 				printf("%s\n", type);
sha1_file.c +41 -36

108 lines not on this page · raw message

------------