Skip to content

Memoize selection gathering #5502

@gmac

Description

@gmac

Been wondering this for a while, but is there a reason why selection gathering isn’t memoized per subtree so that the work isn’t repeated across a list, like what GraphQL JS does? https://github.com/graphql/graphql-js/blob/d26810bd7f1aab0c67736ad958f0c892cbe7343e/src/execution/execute.ts#L66

This is something we’ve seen in our traces for years that lists of objects burn time gathering the same selections over and over. The Cardinal shim cut this step out of its runtime sequencing (using the selections Cardinal builds once up front at the start of each static subtree branch), and I suspect is a big reason why the shim benchmarks slightly faster than native gem execution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions