From a34ce57f66230bb87cebb9a4eecbf2a535569242 Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Fri, 18 Sep 2026 09:30:31 -0500 Subject: [PATCH 1/2] Add a new "ordinary" benchmark for scope parsing Use a very simple and common scope string, to establish a base-case for all of our other generated benchmarks. --- tests/benchmark/test_scope_parser.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/benchmark/test_scope_parser.py b/tests/benchmark/test_scope_parser.py index fdcc18f63..c3cd62053 100644 --- a/tests/benchmark/test_scope_parser.py +++ b/tests/benchmark/test_scope_parser.py @@ -1,6 +1,6 @@ import pytest -from globus_sdk.scopes import ScopeParser +from globus_sdk.scopes import ScopeParser, TransferScopes def _make_deep_scope(depth): @@ -20,6 +20,11 @@ def _make_wide_scope(width): return big_scope +def test_ordinary_scope_parsing(benchmark): + scope_string = f"openid profile {TransferScopes.all}" + benchmark(ScopeParser.parse, scope_string) + + @pytest.mark.parametrize("depth", (10, 100, 1000, 2000, 3000, 4000, 5000)) def test_deep_scope_parsing(benchmark, depth): scope_string = _make_deep_scope(depth) From 74cb31e8a577b4e20326f2d0ae3779823f51e5c4 Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Fri, 18 Sep 2026 09:39:14 -0500 Subject: [PATCH 2/2] Remove the 1x1 "filter missing" benchmark The comment now notes why we don't test 1x1, which looks like an obvious "base case". We found it was much too susceptible to unrelated changes making the benchmark move. --- tests/benchmark/test_filter_missing.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/benchmark/test_filter_missing.py b/tests/benchmark/test_filter_missing.py index 160b54410..78099d40b 100644 --- a/tests/benchmark/test_filter_missing.py +++ b/tests/benchmark/test_filter_missing.py @@ -9,10 +9,13 @@ @pytest.mark.parametrize( ("width", "depth"), ( - # note that the expected number of objects is roughly "WIDTH raised to DEPTH" - # so relatively modest numbers like 5x10 = 5 to the 10th = 9.7 million - # be careful to build wide-but-shallow or deep-but-narrow trees - pytest.param(1, 1, id="1w-1d"), + # Note that the expected number of objects is roughly "WIDTH raised to DEPTH" + # so relatively modest numbers like 5x10 = 5 to the 10th = 9.7 million. + # Be careful to build wide-but-shallow or deep-but-narrow trees. + # + # Experientially, the 1x1 benchmark is so fast that it actually starts to + # measure noise -- e.g., from memory layout in CPython being perturbed. + # Therefore it is omitted and we start at the modest 1x5 and 5x1 shapes. pytest.param(5, 1, id="5w-1d"), pytest.param(1, 5, id="1w-5d"), pytest.param(1, 1000, id="1w-1000d"),