Skip to content

Commit be12681

Browse files
toofishesgitster
authored andcommitted
pack-objects: mark add_to_write_order() as inline
This function is a whole 26 bytes when compiled on x86_64, but is currently invoked over 1.037 billion times when running pack-objects on the Linux kernel git repository. This is hitting the point where micro-optimizations do make a difference, and inlining it only increases the object file size by 38 bytes. As reported by perf, this dropped task-clock from 84183 to 83373 ms, and total cycles from 223.5 billion to 221.6 billion. Not astronomical, but worth getting for adding one word. Signed-off-by: Dan McGee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 703f05a commit be12681

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/pack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ static int mark_tagged(const char *path, const unsigned char *sha1, int flag,
454454
return 0;
455455
}
456456

457-
static void add_to_write_order(struct object_entry **wo,
457+
static inline void add_to_write_order(struct object_entry **wo,
458458
int *endp,
459459
struct object_entry *e)
460460
{

0 commit comments

Comments
 (0)