Commit b0d7f329 by Carlos Martín Nieto

odb: reverse the default backend priorities

We currently first look in the loose object dir and then in the packs
for objects. When performing operations on recent history this has a
higher likelihood of hitting, but when we deal with operations which
look further back into the past, we start spending a large amount of
time getting ENOTENT from `access`.

Reversing the priorities means that long-running operations can get to
their objects faster, as we can look at the index data we have in memory
(or rather mapped) to figure out whether we have an object, which is
faster than going out to the filesystem.

The packed backend already implements an optimistic read algorithm by
first looking at the packs we know about and only going out to disk to
referesh if the object is not found which means that in the case where
we do have the object (which will be in the majority for anything that
traverses the graph) we can avoid going to to disk entirely to determine
whether an object exists.

Operations which look at recent history may take a slight impact, but
these would be operations which look a lot less at object and thus take
less time regardless.
parent f85a9c27
...@@ -21,9 +21,12 @@ ...@@ -21,9 +21,12 @@
#define GIT_ALTERNATES_FILE "info/alternates" #define GIT_ALTERNATES_FILE "info/alternates"
/* TODO: is this correct? */ /*
#define GIT_LOOSE_PRIORITY 2 * We work under the assumption that most objects for long-running
#define GIT_PACKED_PRIORITY 1 * operations will be packed
*/
#define GIT_LOOSE_PRIORITY 1
#define GIT_PACKED_PRIORITY 2
#define GIT_ALTERNATES_MAX_DEPTH 5 #define GIT_ALTERNATES_MAX_DEPTH 5
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment