Skip to content

Commit a539f95

Browse files
committed
TEMP Update benchmarks to use build_graph_rust
1 parent a136851 commit a539f95

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

tests/benchmarking/test_benchmarking.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
import uuid
2-
import random
3-
import pytest
4-
import json
51
import importlib
2+
import json
3+
import random
4+
import uuid
5+
from copy import deepcopy
66
from pathlib import Path
77

8-
from grimp.application.graph import ImportGraph
9-
from grimp import PackageDependency, Route
8+
import pytest
9+
1010
import grimp
11-
from copy import deepcopy
11+
from grimp import PackageDependency, Route
12+
from grimp.application.graph import ImportGraph
1213

1314

1415
@pytest.fixture(scope="module")
@@ -303,7 +304,7 @@ def test_build_django_uncached(benchmark):
303304
304305
In this benchmark, the cache is turned off.
305306
"""
306-
benchmark(grimp.build_graph, "django", cache_dir=None)
307+
benchmark(grimp.build_graph_rust, "django", cache_dir=None)
307308

308309

309310
def test_build_django_from_cache_no_misses(benchmark):
@@ -313,9 +314,9 @@ def test_build_django_from_cache_no_misses(benchmark):
313314
This benchmark fully utilizes the cache.
314315
"""
315316
# Populate the cache first, before beginning the benchmark.
316-
grimp.build_graph("django")
317+
grimp.build_graph_rust("django")
317318

318-
benchmark(grimp.build_graph, "django")
319+
benchmark(grimp.build_graph_rust, "django")
319320

320321

321322
@pytest.mark.parametrize(
@@ -364,7 +365,7 @@ def test_build_django_from_cache_a_few_misses(benchmark, number_of_misses: int):
364365
# turn off multiple runs, which could potentially be misleading when running locally.
365366

366367
# Populate the cache first, before beginning the benchmark.
367-
grimp.build_graph("django")
368+
grimp.build_graph_rust("django")
368369
# Add some modules which won't be in the cache.
369370
# (Use some real python, which will take time to parse.)
370371
django_path = Path(importlib.util.find_spec("django").origin).parent # type: ignore
@@ -380,7 +381,7 @@ def test_build_django_from_cache_a_few_misses(benchmark, number_of_misses: int):
380381
hash_buster = f"\n# Hash busting comment: {uuid.uuid4()}"
381382
new_module.write_text(module_contents + hash_buster)
382383

383-
benchmark.pedantic(grimp.build_graph, ["django"], rounds=1, iterations=1)
384+
benchmark.pedantic(grimp.build_graph_rust, ["django"], rounds=1, iterations=1)
384385

385386
# Delete the modules we just created.
386387
for module in extra_modules:

0 commit comments

Comments
 (0)