Skip to content

Commit

Permalink
Merge remote-tracking branch 'benpeart/fscache-per-thread-gfw'
Browse files Browse the repository at this point in the history
This brings substantial wins in performance because the FSCache is now
per-thread, being merged to the primary thread only at the end, so we do
not have to lock (except while merging).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Nov 25, 2024
2 parents 0454a46 + e19097e commit 091632d
Show file tree
Hide file tree
Showing 10 changed files with 262 additions and 146 deletions.
2 changes: 1 addition & 1 deletion builtin/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ int cmd_add(int argc,
die_in_unpopulated_submodule(repo->index, prefix);
die_path_inside_submodule(repo->index, &pathspec);

enable_fscache(1);
enable_fscache(0);
/* We do not really re-read the index but update the up-to-date flags */
preload_index(repo->index, &pathspec, 0);

Expand Down
4 changes: 2 additions & 2 deletions builtin/checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ static int checkout_worktree(const struct checkout_opts *opts,
if (pc_workers > 1)
init_parallel_checkout();

enable_fscache(1);
enable_fscache(the_repository->index->cache_nr);
for (pos = 0; pos < the_repository->index->cache_nr; pos++) {
struct cache_entry *ce = the_repository->index->cache[pos];
if (ce->ce_flags & CE_MATCHED) {
Expand All @@ -431,7 +431,7 @@ static int checkout_worktree(const struct checkout_opts *opts,
errs |= run_parallel_checkout(&state, pc_workers, pc_threshold,
NULL, NULL);
mem_pool_discard(&ce_mem_pool, should_validate_cache_entries());
enable_fscache(0);
disable_fscache();
remove_marked_cache_entries(the_repository->index, 1);
remove_scheduled_dirs();
errs |= finish_delayed_checkout(&state, opts->show_progress);
Expand Down
4 changes: 2 additions & 2 deletions builtin/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,7 @@ struct repository *repo UNUSED)
PATHSPEC_PREFER_FULL,
prefix, argv);

enable_fscache(1);
enable_fscache(0);
if (status_format != STATUS_FORMAT_PORCELAIN &&
status_format != STATUS_FORMAT_PORCELAIN_V2)
progress_flag = REFRESH_PROGRESS;
Expand Down Expand Up @@ -1616,7 +1616,7 @@ struct repository *repo UNUSED)
wt_status_print(&s);
wt_status_collect_free_buffers(&s);

enable_fscache(0);
disable_fscache();
return 0;
}

Expand Down
Loading

0 comments on commit 091632d

Please sign in to comment.