Skip to content

Conversation

@patrick91
Copy link
Member

@patrick91 patrick91 commented Oct 26, 2025

Summary by Sourcery

Integrate a new optimized is_awaitable implementation into the GraphQL execution pipeline to reduce overhead when handling large result sets of primitive values.

New Features:

  • Add optimized_is_awaitable function with fast path for common synchronous types
  • Expose optimized_is_awaitable in execution utilities

Enhancements:

  • Integrate optimized_is_awaitable into execute and execute_sync to improve performance when checking awaitables

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 26, 2025

Reviewer's Guide

This PR introduces a custom optimized_is_awaitable function for faster awaitability checks on primitive types and integrates it into the GraphQL execution flow by passing it to both async and sync execution methods.

File-Level Changes

Change Details Files
Integrate optimized is_awaitable into execution flow
  • Add is_awaitable=optimized_is_awaitable argument to execute
  • Add is_awaitable=optimized_is_awaitable argument to execute_sync
strawberry/schema/schema.py
Add optimized_is_awaitable function with fast-path checks
  • Define frozenset of non-awaitable types for O(1) lookup
  • Implement optimized_is_awaitable with fast-path and fallback logic
  • Document performance characteristics and usage in docstring
strawberry/execution/is_awaitable.py
Export optimized_is_awaitable from execution package
  • Import optimized_is_awaitable in init.py
  • Add optimized_is_awaitable to all
strawberry/execution/__init__.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov
Copy link

codecov bot commented Oct 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.39%. Comparing base (abbe4c2) to head (2241527).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4035   +/-   ##
=======================================
  Coverage   94.39%   94.39%           
=======================================
  Files         534      536    +2     
  Lines       34834    34849   +15     
  Branches     1831     1832    +1     
=======================================
+ Hits        32881    32896   +15     
  Misses       1657     1657           
  Partials      296      296           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 26, 2025

CodSpeed Performance Report

Merging #4035 will improve performances by 10.58%

Comparing test-is-awaitable (2241527) with main (abbe4c2)

Summary

⚡ 2 improvements
✅ 26 untouched

Benchmarks breakdown

Benchmark BASE HEAD Change
test_stadium[seats_per_row_250] 6.6 s 6 s +10.58%
test_stadium[seats_per_row_500] 13.3 s 12 s +10.58%

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