diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-12-06 22:51:00 +0100 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-12-06 23:17:19 +0100 |
commit | fc4364696556678f4cac4f6cefed17b94b4ec776 (patch) | |
tree | 248cfe2ec1e6ac732a4113a5c0951aa14b7ce442 /src/tree.c | |
parent | 5d1f31c6e67c0f7b8a5cadae32965be9c6123882 (diff) | |
download | libgit2-fc4364696556678f4cac4f6cefed17b94b4ec776.tar.gz |
tree: mark a tree as already sortedcmn/tree-is-sorted
The trees are sorted on-disk, so we don't have to go over them
again. This cuts almost a fifth of time spent parsing trees.
Diffstat (limited to 'src/tree.c')
-rw-r--r-- | src/tree.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tree.c b/src/tree.c index 2de8e72e1..aab4b58ad 100644 --- a/src/tree.c +++ b/src/tree.c @@ -476,7 +476,8 @@ int git_tree__parse(void *_tree, git_odb_object *odb_obj) buffer += GIT_OID_RAWSZ; } - git_vector_sort(&tree->entries); + /* The tree is sorted by definition. Bad inputs give bad outputs */ + tree->entries.flags |= GIT_VECTOR_SORTED; return 0; } |