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

feat(gqlerror): optimize Error method perfomance #328

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

dienvt
Copy link
Contributor

@dienvt dienvt commented Oct 25, 2024

I found that for string concatenation, strings.Builder has better performance than bytes.Buffer. I have already tested the benchmark (cd gqlerror && go test -bench=.) for these approaches, and here are the results:

  • When using bytes.Buffer
goos: darwin
goarch: arm64
pkg: github.com/vektah/gqlparser/v2/gqlerror
cpu: Apple M1 Max
BenchmarkError-10        4554457               262.9 ns/op
  • When using strings.Builder
goos: darwin
goarch: arm64
pkg: github.com/vektah/gqlparser/v2/gqlerror
cpu: Apple M1 Max
BenchmarkError-10        5152414               218.0 ns/op

I have:

  • Added tests covering the bug / feature
  • [] Updated any relevant documentation

@coveralls
Copy link

Coverage Status

coverage: 87.553%. remained the same
when pulling a421f45 on dienvt:gqlerror-optimize-performance
into 6361a74 on vektah:master.

@StevenACoffman StevenACoffman merged commit 89fc137 into vektah:master Oct 25, 2024
5 checks passed
@StevenACoffman
Copy link
Collaborator

Thanks!

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.

3 participants