From 156ab3b9bc3568d655734387e437e60581cf8086 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sun, 29 Nov 2026 12:10:56 +0530 Subject: [PATCH] The GraphQL parser scaling test measures parser work Use the thread CPU clock and pause tracing and collection while timing each parser input. Coverage and collection can distort the size ratio. Signed-off-by: Lareb Zafar --- tests/unit/test_code_lang_graphql.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/unit/test_code_lang_graphql.py b/tests/unit/test_code_lang_graphql.py index 9a641207c85..31e1434510d 100644 --- a/tests/unit/test_code_lang_graphql.py +++ b/tests/unit/test_code_lang_graphql.py @@ -16,7 +16,7 @@ reference_sites, ) from server.code.domain.extract.treesitter import ParsedFile -from tests.unit.code_fixtures import assert_linear +from tests.unit.code_fixtures import assert_linear, untraced SCHEMA = b'''# the shop API @@ -247,8 +247,9 @@ def test_broken_input_parses_without_error(src: bytes) -> None: def test_a_file_of_many_units_parses_in_linear_time(unit: str) -> None: def cost(n: int) -> float: src = (unit * n).encode() - t0 = time.perf_counter() + t0 = time.thread_time() reference_sites(parse_graphql("a.graphql", src)) - return time.perf_counter() - t0 + return time.thread_time() - t0 - assert_linear(cost, 2_000, 8_000) + with untraced(): + assert_linear(cost, 2_000, 8_000)