git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] pack-objects: mark add_to_write_order() as inline
@ 2011-10-18  5:21 Dan McGee
  2011-10-18  5:21 ` [PATCH 2/4] pack-objects: use unsigned int for counter and offset values Dan McGee
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Dan McGee @ 2011-10-18  5:21 UTC (permalink / raw)
  To: git

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>
---
 builtin/pack-objects.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 2b18de5..0ab3a3b 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -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)
 {
-- 
1.7.7

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-11-14  5:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-18  5:21 [PATCH 1/4] pack-objects: mark add_to_write_order() as inline Dan McGee
2011-10-18  5:21 ` [PATCH 2/4] pack-objects: use unsigned int for counter and offset values Dan McGee
2011-10-18  5:21 ` [PATCH 3/4] pack-objects: don't traverse objects unnecessarily Dan McGee
2011-10-27 22:26   ` Junio C Hamano
2011-11-09  4:31     ` Dan McGee
2011-11-12  6:55       ` Junio C Hamano
2011-11-13 22:34         ` Dan McGee
2011-11-14  5:40           ` Junio C Hamano
2011-10-18  5:21 ` [PATCH 4/4] pack-objects: rewrite add_descendants_to_write_order() iteratively Dan McGee
2011-10-27 22:13   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).