Skip to content

Commit

Permalink
Add benchmark for "..." in graph.modules
Browse files Browse the repository at this point in the history
In the rust backed implementation this is significantly slower
(currently), so lets add a benchmark to track this.
  • Loading branch information
Peter554 committed Feb 6, 2025
1 parent 0523253 commit 3510cb4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/benchmarking/test_benchmarking.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def large_graph():
f"{DEEP_PACKAGE}.application.3242334296.2454157946",
)


TOP_LEVEL_PACKAGE_DEPENDENCIES = {
PackageDependency(
importer="mypackage.domain",
Expand Down Expand Up @@ -423,3 +422,11 @@ def test_no_chains(self, large_graph, benchmark):

def test_copy_graph(large_graph, benchmark):
_run_benchmark(benchmark, lambda: deepcopy(large_graph))


def test_graph_contains_module(large_graph, benchmark):
def f(n):
for i in range(n):
_ = f"foo{i}" in large_graph.modules

_run_benchmark(benchmark, f, 100)

0 comments on commit 3510cb4

Please # to comment.