diff --git a/services/horizon/CHANGELOG.md b/services/horizon/CHANGELOG.md index 938476638f..49125a18ab 100644 --- a/services/horizon/CHANGELOG.md +++ b/services/horizon/CHANGELOG.md @@ -32,7 +32,9 @@ file. This project adheres to [Semantic Versioning](http://semver.org/). - Improved performance of requests which query the lower boundary of horizon's history when running a horizon instance with the `--history-retention-count` flag. ([5410](https://github.com/stellar/go/pull/5410), [5448](https://github.com/stellar/go/pull/5448), [5465](https://github.com/stellar/go/pull/5465)) -- Improve performance of ingestion when running horizon with the `--history-retention-count` flag by executing reaping of history lookup tables concurrently with ingestion ([5405](https://github.com/stellar/go/pull/5405)). +- Improve performance of ingestion when running horizon with the `--history-retention-count` flag by executing reaping of history lookup tables concurrently with ingestion. ([5405](https://github.com/stellar/go/pull/5405)) + +- Improve performance of ingestion when consuming ledgers via the BufferedStorageBackend. ([5494](https://github.com/stellar/go/pull/5494)) ## 2.32.0 diff --git a/support/compressxdr/compress_xdr.go b/support/compressxdr/compress_xdr.go index 514251f971..7fc957d2a8 100644 --- a/support/compressxdr/compress_xdr.go +++ b/support/compressxdr/compress_xdr.go @@ -3,7 +3,7 @@ package compressxdr import ( "io" - xdr3 "github.com/stellar/go-xdr/xdr3" + "github.com/stellar/go/xdr" ) func NewXDREncoder(compressor Compressor, xdrPayload interface{}) XDREncoder { @@ -29,7 +29,7 @@ func (e XDREncoder) WriteTo(w io.Writer) (int64, error) { } defer zw.Close() - n, err := xdr3.Marshal(zw, e.XdrPayload) + n, err := xdr.Marshal(zw, e.XdrPayload) return int64(n), err } @@ -47,6 +47,6 @@ func (d XDRDecoder) ReadFrom(r io.Reader) (int64, error) { } defer zr.Close() - n, err := xdr3.Unmarshal(zr, d.XdrPayload) + n, err := xdr.Unmarshal(zr, d.XdrPayload) return int64(n), err } diff --git a/support/compressxdr/compress_xdr_test.go b/support/compressxdr/compress_xdr_test.go index 82aa7e186c..79d6b65690 100644 --- a/support/compressxdr/compress_xdr_test.go +++ b/support/compressxdr/compress_xdr_test.go @@ -2,10 +2,13 @@ package compressxdr import ( "bytes" + "io/ioutil" + "os" "testing" - "github.com/stellar/go/xdr" "github.com/stretchr/testify/require" + + "github.com/stellar/go/xdr" ) func createTestLedgerCloseMetaBatch(startSeq, endSeq uint32, count int) xdr.LedgerCloseMetaBatch { @@ -46,3 +49,34 @@ func TestEncodeDecodeLedgerCloseMetaBatch(t *testing.T) { require.Equal(t, testData.LedgerCloseMetas[i], decodedData.LedgerCloseMetas[i]) } } + +func BenchmarkDecodeLedgerCloseMetaBatch(b *testing.B) { + lcmBatch := xdr.LedgerCloseMetaBatch{} + decoder := NewXDRDecoder(DefaultCompressor, &lcmBatch) + + for n := 0; n < b.N; n++ { + file, err := os.Open("testdata/FCD285FF--53312000.xdr.zstd") + require.NoError(b, err) + + _, err = decoder.ReadFrom(file) + require.NoError(b, err) + } +} + +func BenchmarkEncodeLedgerCloseMetaBatch(b *testing.B) { + lcmBatch := xdr.LedgerCloseMetaBatch{} + decoder := NewXDRDecoder(DefaultCompressor, &lcmBatch) + file, err := os.Open("testdata/FCD285FF--53312000.xdr.zstd") + require.NoError(b, err) + + _, err = decoder.ReadFrom(file) + require.NoError(b, err) + + b.ResetTimer() + + for n := 0; n < b.N; n++ { + encoder := NewXDREncoder(DefaultCompressor, &lcmBatch) + _, err = encoder.WriteTo(ioutil.Discard) + require.NoError(b, err) + } +} diff --git a/support/compressxdr/testdata/FCD285FF--53312000.xdr.zstd b/support/compressxdr/testdata/FCD285FF--53312000.xdr.zstd new file mode 100644 index 0000000000..e6d901815a Binary files /dev/null and b/support/compressxdr/testdata/FCD285FF--53312000.xdr.zstd differ