commit.h: rearrange 'index' to shrink struct commit
PATCH 1/1 commit.h: rearrange 'index' to shrink struct commit
On linux 64-bit architecture, pahole finds that there's a 4 bytes padding after 'index'. Moving it to the end reduces this struct's size from 72 to 64 bytes (because of another 4 bytes padding after graph_pos). On linux 32-bit, the struct size remains 52 bytes like before.
Signed-off-by Nguyễn Thái Ngọc Duy <[email protected]>
--- commit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
commit.h +1 -1
@@ -19,11 +19,11 @@ struct commit_list {struct commit {struct object object;void *util; -unsigned int index;timestamp_t date;struct commit_list *parents;struct tree *tree;uint32_t graph_pos; +unsigned int index; };extern int save_commit_buffer;
Signature · 1 line
2.17.0.705.g3525833791
Quoted 18 lines · Nguyễn Thái Ngọc Duy
On linux 64-bit architecture, pahole finds that there's a 4 bytes padding after 'index'. Moving it to the end reduces this struct's size from 72 to 64 bytes (because of another 4 bytes padding after
graph_pos). On linux 32-bit, the struct size remains 52 bytes like before.Signed-off-by Nguyễn Thái Ngọc Duy <[email protected]>--- commit.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)commit.h +0
-0@@ -19,11 +19,11 @@ struct commit_list {struct commit {struct object object;
commit.h struct commit_list { · line 29
Quoted 10 lines
commit.h +1
-1void *util; -unsigned int index;timestamp_t date;struct commit_list *parents;struct tree *tree;uint32_t graph_pos; +unsigned int index; };extern int save_commit_buffer;
Quite nice.