Skip to content

Reduce repeated work for fields without arguments #298

Closed

Description

@dexhunter

Executor.execute_field calls argument coercion for every field, including fields with no arguments.
Its async error handler also captures local values during synchronous execution.
This adds repeated work when executing introspection queries on large schemas.

A local change uses an empty dictionary when the schema field and query node both have no arguments.
It passes async error-handler state as parameters and keeps the normal resolver-information constructor.

Situation Before After Change
GitHub schema introspection 256.18 ms 246.13 ms 3.9% less time
Async list with 1,000 items 1.191 ms 1.201 ms Within variation: 0.9% more time
Large query pickle decoding 6.938 ms 7.165 ms Within variation: 3.3% more time

These are medians from the existing repository benchmarks, with at least 50 rounds on the same CPU.
The async-list and pickle-decoding slowdowns are smaller than the larger interquartile spread from their respective runs.

Related: #142 discusses async execution overhead; this proposal measures synchronous introspection.

Environment: CPython 3.12.13, Linux x86-64, AMD EPYC 9R14.
Base commit: f9bdf7c5c728a04bd3f27bfb8d394e9ac95751e2.

Reproduce on the base and changed versions:

PYTHONPATH=src python -m pytest tests/benchmarks/test_introspection_from_schema.py tests/benchmarks/test_async_iterable.py tests/benchmarks/test_serialization.py::test_pickle_large_query_decode --benchmark-enable --benchmark-min-rounds=50

The full test suite passes: 3,613 passed, 18 skipped.
Ruff, formatting, and mypy also pass.
Codex helped prepare and test the change; candidate results were tracked with Weco Observe.

Would this small Python execution change fit the project's maintenance goals?

Activity

  1. changed the title [-]# Reduce repeated work for fields without arguments[/-] [+]Reduce repeated work for fields without arguments[/+] on Nov 5, 2026
  2. Cito commented on Nov 5, 2026

    @Cito
    Member

    Closed via #299.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions