{"thread":{"id":"3285","subject":"[PATCH] delta micro optimization","startedAt":"2006-02-10T18:42:05Z","lastAt":"2006-02-10T20:38:57Z","messageCount":3,"participants":["Nicolas Pitre","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"15853","messageId":"Pine.LNX.4.64.0602101335160.5397@localhost.localdomain","threadId":"3285","inReplyTo":null,"subject":"[PATCH] delta micro optimization","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2006-02-10T18:42:05Z","receivedAt":"2006-02-10T18:42:05Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"My kernel work habit made me look at the generated assembly for the \ndelta code, and one obvious albeit small improvement is this patch.\n\nSigned-off-by: Nicolas Pitre <nico@cam.org>\n\n---\n\ndiff --git a/delta.h b/delta.h\nindex 31d1820..a15350d 100644\n--- a/delta.h\n+++ b/delta.h\n@@ -19,14 +19,14 @@ extern void *patch_delta(void *src_buf, \n static inline unsigned long get_delta_hdr_size(const unsigned char **datap)\n {\n \tconst unsigned char *data = *datap;\n-\tunsigned char cmd = *data++;\n-\tunsigned long size = cmd & ~0x80;\n-\tint i = 7;\n-\twhile (cmd & 0x80) {\n+\tunsigned char cmd;\n+\tunsigned long size = 0;\n+\tint i = 0;\n+\tdo {\n \t\tcmd = *data++;\n \t\tsize |= (cmd & ~0x80) << i;\n \t\ti += 7;\n-\t}\n+\t} while (cmd & 0x80);\n \t*datap = data;\n \treturn size;\n }\n"},{"id":"15879","messageId":"7vhd77vv9o.fsf@assigned-by-dhcp.cox.net","threadId":"3285","inReplyTo":"Pine.LNX.4.64.0602101335160.5397@localhost.localdomain","subject":"Re: [PATCH] delta micro optimization","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-10T20:00:51Z","receivedAt":"2006-02-10T20:00:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"That looks obviously correct but it really is micro.  Have you\nbenched it?  On which architectures?  Does it help everywhere or\nregister starved ones benefit more than others?\n"},{"id":"15858","messageId":"Pine.LNX.4.64.0602101516310.5397@localhost.localdomain","threadId":"3285","inReplyTo":"7vhd77vv9o.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] delta micro optimization","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2006-02-10T20:38:57Z","receivedAt":"2006-02-10T20:38:57Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Fri, 10 Feb 2006, Junio C Hamano wrote:\n\n> That looks obviously correct but it really is micro.  Have you\n> benched it?  On which architectures?  Does it help everywhere or\n> register starved ones benefit more than others?\n\nI doubt the performance difference would be measurable on i386 although \nthe code is a bit smaller.\n\nOn ARM it causes a code reduction of 12.5% in count-delta.o.\n\n\nNicolas\n"}]}