summaryrefslogtreecommitdiff
path: root/src/buffer.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-05-17 13:06:20 -0700
committerRussell Belfer <rb@github.com>2012-05-17 13:06:20 -0700
commitb59c73d39a0bb3ddb6fd4e81f796018c2b3a0579 (patch)
tree27e61863405c09e510fe9d419a19366b20353cf9 /src/buffer.h
parent706a9974a297ea1b38c6aab886b54598409725e8 (diff)
downloadlibgit2-b59c73d39a0bb3ddb6fd4e81f796018c2b3a0579.tar.gz
Optimize away git_text_gather_stats in diff
GProf shows `git_text_gather_stats` as the most expensive call in large diffs. The function calculates a lot of information that is not actually used and does not do so in a optimal order. This introduces a tuned `git_buf_is_binary` function that executes the same algorithm in a fraction of the time.
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h
index af760f901..090b43548 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -125,4 +125,7 @@ int git_buf_cmp(const git_buf *a, const git_buf *b);
/* Fill buf with the common prefix of a array of strings */
int git_buf_common_prefix(git_buf *buf, const git_strarray *strings);
+/* Check if buffer looks like it contains binary data */
+bool git_buf_is_binary(const git_buf *buf);
+
#endif