Skip to content

Add benchmark for executing fields with arguments - #276

Merged
Cito merged 1 commit into
graphql-python:mainfrom
patrick91:benchmark-field-arguments
Oct 1, 2026
Merged

Cito merged 1 commit into
graphql-python:mainfrom
patrick91:benchmark-field-arguments

Conversation

@patrick91

@patrick91 patrick91 commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

This adds a benchmark for executing fields that take arguments.

None of the existing benchmarks resolves a field with arguments, so argument coercion (get_argument_values → coerce_argument → coerce_input_literal) isn't tracked by CodSpeed at the moment. The new benchmark resolves a list of 1,000 objects whose field takes a literal argument:

query ($count: Int!) { items(count: $count) { value(multiplier: 2) } }

For context, we noticed this while upgrading Strawberry to 3.3.0: on an equivalent 2,000-field query, plain graphql-core execution went from about 5.5 ms on 3.2.11 to about 7.4 ms on 3.3.0 locally, and a good part of the extra per-field work is in argument coercion. Having a benchmark for it should make it easier to track and improve. I have a couple of small optimizations for that path that I'm happy to send as a follow-up PR if they're welcome.

The benchmark follows the style of test_execution_sync.py and passes ruff and mypy.

AI: I've done this with Claude 😊

@codspeed

codspeed Bot commented Sep 28, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 19 untouched benchmarks
🆕 1 new benchmark

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 test_execute_field_arguments_sync N/A 126.9 ms N/A

Comparing patrick91:benchmark-field-arguments (d49dddb) with main (894141f)

Open in CodSpeed

@Cito
Cito merged commit d49dddb into graphql-python:main Oct 1, 2026
11 checks passed
@Cito
Cito removed their request for review October 1, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants