File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -34,10 +34,30 @@ def large_graph():
3434)
3535
3636
37- def test_build_django (benchmark ):
37+ def test_build_django_uncached (benchmark ):
3838 """
3939 Benchmarks building a graph of real package - in this case Django.
40+
41+ In this benchmark, the cache is turned off.
42+ """
43+ fn = lambda : grimp .build_graph ("django" , cache_dir = None )
44+ if hasattr (benchmark , "pendantic" ):
45+ # Running with pytest-benchmark
46+ benchmark .pedantic (fn , rounds = 3 )
47+ else :
48+ # Running with codspeed.
49+ benchmark (fn )
50+
51+
52+ def test_build_django_from_cache (benchmark ):
4053 """
54+ Benchmarks building a graph of real package - in this case Django.
55+
56+ This benchmark uses the cache.
57+ """
58+ # Populate the cache first, before beginning the benchmark.
59+ grimp .build_graph ("django" )
60+
4161 fn = lambda : grimp .build_graph ("django" )
4262 if hasattr (benchmark , "pendantic" ):
4363 # Running with pytest-benchmark
You can’t perform that action at this time.
0 commit comments