Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve: optimize graphql runtime #3372

Open
lkeix opened this issue Nov 13, 2024 · 0 comments
Open

Improve: optimize graphql runtime #3372

lkeix opened this issue Nov 13, 2024 · 0 comments

Comments

@lkeix
Copy link
Contributor

lkeix commented Nov 13, 2024

What happened?

The transport.Post implementation in the Do method has potential for optimization. Specifically, two areas could improve performance:

  1. The Do method frequently converts []byte to string, which incurs additional allocations.
  2. graphql.RawParams could benefit from a sync.Pool to reduce allocations and reuse memory.

What did you expect?

Optimizing memory allocation in the Do method should lead to better overall performance for the gqlgen server, especially for high-throughput applications.

Minimal graphql.schema and models to reproduce

I tested using the gqlgen initial schema and an empty slice return for the Todos query, observing allocation patterns during benchmarking.

Versions

  • gqlgen version: v0.17.55 (via go run github.com/99designs/gqlgen version)
  • Go version: go1.23.2 darwin/amd64

Pull Request

#3373

@lkeix lkeix changed the title Improve: optimize transport.Post Improve: optimize graphql runtime Nov 20, 2024
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

No branches or pull requests

1 participant