xataio / pgstream

PostgreSQL replication with DDL changes
http://www.xata.io
Apache License 2.0
349 stars 11 forks source link

Performance improvements #84

Closed eminano closed 1 month ago

eminano commented 1 month ago

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: