Skip to content

Commit cfeec8e

Browse files
jeffhostetlerdscho
authored andcommitted
trace2:gvfs:experiment: read-cache: time read/write of cache-tree extension
Add regions around code to read and write the cache-tree extension when the index is read or written. This is an experiment and may be dropped in future releases if we don't need it anymore. This experiment demonstrates that it takes more time to parse and deserialize the cache-tree extension than it does to read the cache-entries. Commits [1] and [2] spreads cache-entry reading across N-1 cores and dedicates a single core to simultaneously read the index extensions. Local testing (on my machine) shows that reading the cache-tree extension takes ~0.28 seconds. The 11 cache-entry threads take ~0.08 seconds. The main thread is blocked for 0.15 to 0.20 seconds waiting for the extension thread to finish. Let's use this commit to gather some telemetry and confirm this. My point is that improvements, such as index V5 which makes the cache entries smaller, may improve performance, but the gains may be limited because of this extension. And that we may need to look inside the cache-tree extension to truly improve do_read_index() performance. [1] abb4bb8 read-cache: load cache extensions on a worker thread [2] 77ff112 read-cache: load cache entries on worker threads Signed-off-by: Jeff Hostetler <[email protected]>
1 parent b386bba commit cfeec8e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

read-cache.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,10 @@ static int read_index_extension(struct index_state *istate,
17371737
{
17381738
switch (CACHE_EXT(ext)) {
17391739
case CACHE_EXT_TREE:
1740+
trace2_region_enter("index", "read/extension/cache_tree", NULL);
17401741
istate->cache_tree = cache_tree_read(data, sz);
1742+
trace2_data_intmax("index", NULL, "read/extension/cache_tree/bytes", (intmax_t)sz);
1743+
trace2_region_leave("index", "read/extension/cache_tree", NULL);
17411744
break;
17421745
case CACHE_EXT_RESOLVE_UNDO:
17431746
istate->resolve_undo = resolve_undo_read(data, sz, the_hash_algo);
@@ -3024,9 +3027,13 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
30243027
!drop_cache_tree && istate->cache_tree) {
30253028
strbuf_reset(&sb);
30263029

3030+
trace2_region_enter("index", "write/extension/cache_tree", NULL);
30273031
cache_tree_write(&sb, istate->cache_tree);
30283032
err = write_index_ext_header(f, eoie_c, CACHE_EXT_TREE, sb.len) < 0;
30293033
hashwrite(f, sb.buf, sb.len);
3034+
trace2_data_intmax("index", NULL, "write/extension/cache_tree/bytes", (intmax_t)sb.len);
3035+
trace2_region_leave("index", "write/extension/cache_tree", NULL);
3036+
30303037
if (err) {
30313038
ret = -1;
30323039
goto out;

0 commit comments

Comments
 (0)