Skip to content

Commit 4060b73

Browse files
neerajsi-msftdscho
authored andcommitted
unpack-objects: use the bulk-checkin infrastructure
The unpack-objects functionality is used by fetch, push, and fast-import to turn the transfered data into object database entries when there are fewer objects than the 'unpacklimit' setting. By enabling an odb-transaction when unpacking objects, we can take advantage of batched fsyncs. Here are some performance numbers to justify batch mode for unpack-objects, collected on a WSL2 Ubuntu VM. Fsync Mode | Time for 90 objects (ms) ------------------------------------- Off | 170 On,fsync | 760 On,batch | 230 Note that the default unpackLimit is 100 objects, so there's a 3x benefit in the worst case. The non-batch mode fsync scales linearly with the number of objects, so there are significant benefits even with smaller numbers of objects. Signed-off-by: Neeraj Singh <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5649d5b commit 4060b73

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

builtin/unpack-objects.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "builtin.h"
22
#include "cache.h"
3+
#include "bulk-checkin.h"
34
#include "config.h"
45
#include "object-store.h"
56
#include "object.h"
@@ -503,10 +504,12 @@ static void unpack_all(void)
503504
if (!quiet)
504505
progress = start_progress(_("Unpacking objects"), nr_objects);
505506
CALLOC_ARRAY(obj_list, nr_objects);
507+
begin_odb_transaction();
506508
for (i = 0; i < nr_objects; i++) {
507509
unpack_one(i);
508510
display_progress(progress, i + 1);
509511
}
512+
end_odb_transaction();
510513
stop_progress(&progress);
511514

512515
if (delta_list)

0 commit comments

Comments
 (0)