Skip to content

Commit

Permalink
pack-objects: mark add_to_write_order() as inline
Browse files Browse the repository at this point in the history
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 <dpmcgee@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Dan McGee authored and Junio C Hamano committed Oct 18, 2011
1 parent 703f05a commit be12681
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin/pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ static int mark_tagged(const char *path, const unsigned char *sha1, int flag,
return 0;
}

static void add_to_write_order(struct object_entry **wo,
static inline void add_to_write_order(struct object_entry **wo,
int *endp,
struct object_entry *e)
{
Expand Down

0 comments on commit be12681

Please sign in to comment.