Improve: optimize graphql runtime
- Linguagem predominante
- Go
- Estrelas
- 10.8k
- Forks
- 1.3k
- Merge médio
- 2d 36min
- PRs com merge (30d)
- 26
Descrição
### 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
https://github.com/99designs/gqlgen/pull/3373
Guia de contribuição
Direção de pesquisa
The issue points to the `transport.Post` implementation's `Do` method and suggests optimizing `[]byte` to `string` conversions and using a `sync.Pool` for `graphql.RawParams`. Start by locating the `Do` method in the codebase, likely in a transport package. Examine the allocation patterns and benchmark the current implementation. Understanding Go's memory management and sync.Pool usage is essential. The linked pull request #3373 may provide context or a starting implementation to review.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- go
- Domínio
- performance
- Tipo de issue
- Refatoração
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 35/100