{"thread":{"id":"48466","subject":"[PATCH] commit.h: rearrange 'index' to shrink struct commit","startedAt":"2018-05-11T17:21:05Z","lastAt":"2018-05-13T02:03:55Z","messageCount":2,"participants":["Nguyễn Thái Ngọc Duy","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"347365","messageId":"20180511172054.7684-1-pclouds@gmail.com","threadId":"48466","inReplyTo":null,"subject":"[PATCH] commit.h: rearrange 'index' to shrink struct commit","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2018-05-11T17:20:54Z","receivedAt":"2018-05-11T17:21:05Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On linux 64-bit architecture, pahole finds that there's a 4 bytes\npadding after 'index'. Moving it to the end reduces this struct's size\nfrom 72 to 64 bytes (because of another 4 bytes padding after\ngraph_pos). On linux 32-bit, the struct size remains 52 bytes like\nbefore.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n commit.h | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/commit.h b/commit.h\nindex e57ae4b583..fd1cbe7263 100644\n--- a/commit.h\n+++ b/commit.h\n@@ -19,11 +19,11 @@ struct commit_list {\n struct commit {\n \tstruct object object;\n \tvoid *util;\n-\tunsigned int index;\n \ttimestamp_t date;\n \tstruct commit_list *parents;\n \tstruct tree *tree;\n \tuint32_t graph_pos;\n+\tunsigned int index;\n };\n \n extern int save_commit_buffer;\n-- \n2.17.0.705.g3525833791\n\n"},{"id":"347478","messageId":"xmqqmux4e2gq.fsf@gitster-ct.c.googlers.com","threadId":"48466","inReplyTo":"20180511172054.7684-1-pclouds@gmail.com","subject":"Re: [PATCH] commit.h: rearrange 'index' to shrink struct commit","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-05-13T02:03:49Z","receivedAt":"2018-05-13T02:03:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:\n\n> On linux 64-bit architecture, pahole finds that there's a 4 bytes\n> padding after 'index'. Moving it to the end reduces this struct's size\n> from 72 to 64 bytes (because of another 4 bytes padding after\n> graph_pos). On linux 32-bit, the struct size remains 52 bytes like\n> before.\n>\n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>  commit.h | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/commit.h b/commit.h\n> index e57ae4b583..fd1cbe7263 100644\n> --- a/commit.h\n> +++ b/commit.h\n> @@ -19,11 +19,11 @@ struct commit_list {\n>  struct commit {\n>  \tstruct object object;\n>  \tvoid *util;\n> -\tunsigned int index;\n>  \ttimestamp_t date;\n>  \tstruct commit_list *parents;\n>  \tstruct tree *tree;\n>  \tuint32_t graph_pos;\n> +\tunsigned int index;\n>  };\n>  \n>  extern int save_commit_buffer;\n\nQuite nice.\n"}]}