{"thread":{"id":"10630","subject":"Why is --pretty=format: so slow?","startedAt":"2007-11-04T03:42:54Z","lastAt":"2007-11-04T13:53:39Z","messageCount":5,"participants":["Paul Mackerras","Junio C Hamano","René Scharfe"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"58203","messageId":"18221.16318.785162.44769@cargo.ozlabs.ibm.com","threadId":"10630","inReplyTo":null,"subject":"Why is --pretty=format: so slow?","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2007-11-04T03:42:54Z","receivedAt":"2007-11-04T03:42:54Z","isPatch":false,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"For some reason, using --pretty=format:... with git log is much slower\nthan other formats.  For example, on the kernel tree (on my quad G5):\n\n$ time git log --pretty=oneline >/dev/null\n\nreal    0m2.165s\nuser    0m2.092s\nsys     0m0.070s\n\n$ time git log --pretty=raw >/dev/null\n\nreal    0m2.426s\nuser    0m2.358s\nsys     0m0.068s\n\n$ time git log --pretty=\"format:%H\" >/dev/null\n\nreal    0m7.843s\nuser    0m6.282s\nsys     0m1.557s\n\n$ time git log --pretty=\"format:%H {%P} %ct\" >/dev/null\n\nreal    0m7.950s\nuser    0m6.374s\nsys     0m1.573s\n\nStrace seems to indicate that git log is doing at least one sequence\nof open, fstat64, fcntl64, getdents64 and close for each line of\noutput in the --pretty=format: cases, but not in the other cases.\nThis seems rather unnecessary - could it be fixed?  I'd like to use\nthe last format listed above with gitk, but not if it is going to make\nthings 3 times slower.\n\nPaul.\n"},{"id":"58206","messageId":"7vmytuvdvq.fsf@gitster.siamese.dyndns.org","threadId":"10630","inReplyTo":"18221.16318.785162.44769@cargo.ozlabs.ibm.com","subject":"Re: Why is --pretty=format: so slow?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-11-04T04:22:17Z","receivedAt":"2007-11-04T04:22:17Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paul Mackerras <paulus@samba.org> writes:\n\n> Strace seems to indicate that git log is doing at least one sequence\n> of open, fstat64, fcntl64, getdents64 and close for each line of\n> output in the --pretty=format: cases, but not in the other cases.\n\nI bet that is coming from doing find_unique_abbrev() to fill\nfields %h, %t and %p, even when the output format does not ask\nfor any of them.\n\nDscho, can we stop calling find_unique_abbrev() unconditionally\nbefore being asked?\n"},{"id":"58241","messageId":"472D9F6E.8070609@lsrfire.ath.cx","threadId":"10630","inReplyTo":"7vmytuvdvq.fsf@gitster.siamese.dyndns.org","subject":"Re: Why is --pretty=format: so slow?","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2007-11-04T10:31:10Z","receivedAt":"2007-11-04T10:31:10Z","isPatch":false,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Junio C Hamano schrieb:\n> Paul Mackerras <paulus@samba.org> writes:\n> \n>> Strace seems to indicate that git log is doing at least one sequence\n>> of open, fstat64, fcntl64, getdents64 and close for each line of\n>> output in the --pretty=format: cases, but not in the other cases.\n> \n> I bet that is coming from doing find_unique_abbrev() to fill\n> fields %h, %t and %p, even when the output format does not ask\n> for any of them.\n> \n> Dscho, can we stop calling find_unique_abbrev() unconditionally\n> before being asked?\n\nIncidentally, I'm finishing a patch series to add git-describe style\nplaceholders.  It needs such an optimization even more badly (and has\nit).  Speeding up other slow placeholder expansions falls out quite\nnaturally.  Please wait just a few minutes..\n\nRené\n"},{"id":"58253","messageId":"7vhck2s02z.fsf@gitster.siamese.dyndns.org","threadId":"10630","inReplyTo":"472D9F6E.8070609@lsrfire.ath.cx","subject":"Re: Why is --pretty=format: so slow?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-11-04T11:48:36Z","receivedAt":"2007-11-04T11:48:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:\n\n> Incidentally, I'm finishing a patch series to add git-describe style\n> placeholders.  It needs such an optimization even more badly (and has\n> it).  Speeding up other slow placeholder expansions falls out quite\n> naturally.  Please wait just a few minutes..\n\nThanks, and take your time, as I am just going to bed, dreaming\nfor a perfect series from one of the few people on this list\nwhose patches I do not have to read to reject crap, but I do\nread to get impressed and admire ;-)\n"},{"id":"58267","messageId":"472DCEE3.501@lsrfire.ath.cx","threadId":"10630","inReplyTo":"7vhck2s02z.fsf@gitster.siamese.dyndns.org","subject":"Re: Why is --pretty=format: so slow?","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2007-11-04T13:53:39Z","receivedAt":"2007-11-04T13:53:39Z","isPatch":false,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Junio C Hamano schrieb:\n> René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:\n> \n>> Incidentally, I'm finishing a patch series to add git-describe\n>> style placeholders.  It needs such an optimization even more badly\n>> (and has it).  Speeding up other slow placeholder expansions falls\n>> out quite naturally.  Please wait just a few minutes..\n> \n> Thanks, and take your time, as I am just going to bed, dreaming for a\n> perfect series from one of the few people on this list whose patches\n> I do not have to read to reject crap, but I do read to get impressed\n> and admire ;-)\n\n*blushes*\n\nWell, it's certainly not perfect -- I just noticed I've sent the patches\nto your old address.  Would you like me to resend them?\n\nAnd, of course, I found a conceptual bug (which is impossible to trigger\nwith the current code, fortunately), while looking over the changes a\nlast time.  *sigh*.  I'll send a fix right away.\n\nRené\n"}]}