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

Performance improvements #84

Merged
merged 2 commits into from
Oct 24, 2024
Merged

Performance improvements #84

merged 2 commits into from
Oct 24, 2024

Conversation

eminano
Copy link
Collaborator

@eminano eminano commented Oct 24, 2024

This PR updates the json library to improve performance of encoding during the hot path. The changes are a drop in replacement using the sonic library.

It also updates the method to retrieve the table column in the translator to avoid the memory allocation.

goos: darwin
goarch: arm64
pkg: github.com/xataio/pgstream/pkg/schemalog
cpu: Apple M2
Benchmark_GetColumnByName-8        	10212780	       125.7 ns/op	     320 B/op	       4 allocs/op
Benchmark_GetColumnByNameNoPtr-8   	98911633	        12.06 ns/op	       0 B/op	       0 allocs/op

Relates to https://github.com/xataio/xata/pull/5004, where benchmarks were performed under load comparing go-json and sonic libraries:

@eminano eminano requested a review from exekias October 24, 2024 12:51
@eminano eminano changed the title Use more performant json library Performance improvements Oct 24, 2024
@eminano eminano merged commit 110b333 into main Oct 24, 2024
5 checks passed
@eminano eminano deleted the update-json-lib branch October 24, 2024 14:38
@eminano eminano mentioned this pull request Oct 25, 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

Successfully merging this pull request may close these issues.

2 participants