File tree Expand file tree Collapse file tree 5 files changed +32
-2
lines changed
Expand file tree Collapse file tree 5 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 190190/test-mktemp
191191/test-parse-options
192192/test-path-utils
193+ /test-read-cache
193194/test-regex
194195/test-revision-walking
195196/test-run-command
Original file line number Diff line number Diff line change @@ -565,6 +565,7 @@ TEST_PROGRAMS_NEED_X += test-mergesort
565565TEST_PROGRAMS_NEED_X += test-mktemp
566566TEST_PROGRAMS_NEED_X += test-parse-options
567567TEST_PROGRAMS_NEED_X += test-path-utils
568+ TEST_PROGRAMS_NEED_X += test-read-cache
568569TEST_PROGRAMS_NEED_X += test-regex
569570TEST_PROGRAMS_NEED_X += test-revision-walking
570571TEST_PROGRAMS_NEED_X += test-run-command
Original file line number Diff line number Diff line change @@ -1518,8 +1518,9 @@ int discard_index(struct index_state *istate)
15181518 free_name_hash (istate );
15191519 cache_tree_free (& (istate -> cache_tree ));
15201520 istate -> initialized = 0 ;
1521-
1522- /* no need to throw away allocated active_cache */
1521+ free (istate -> cache );
1522+ istate -> cache = NULL ;
1523+ istate -> cache_alloc = 0 ;
15231524 return 0 ;
15241525}
15251526
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ test_description=" Tests performance of reading the index"
4+
5+ . ./perf-lib.sh
6+
7+ test_perf_default_repo
8+
9+ count=1000
10+ test_perf " read_cache/discard_cache $count times" "
11+ test-read-cache $count
12+ "
13+
14+ test_done
Original file line number Diff line number Diff line change 1+ #include "cache.h"
2+
3+ int main (int argc , char * * argv )
4+ {
5+ int i , cnt = 1 ;
6+ if (argc == 2 )
7+ cnt = strtol (argv [1 ], NULL , 0 );
8+ for (i = 0 ; i < cnt ; i ++ ) {
9+ read_cache ();
10+ discard_cache ();
11+ }
12+ return 0 ;
13+ }
You can’t perform that action at this time.
0 commit comments