Skip to content

Commit

Permalink
Improve allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio committed Aug 4, 2023
1 parent 9f554b4 commit 6c01757
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/soroban-rpc/internal/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (rw *readWriter) NewTx(ctx context.Context) (WriteTx, error) {
stmtCache: stmtCache,
buffer: xdr.NewEncodingBuffer(),
keyToEntryBatch: make(map[string]*xdr.LedgerEntry, rw.maxBatchSize),
keyToEntryPendingCacheUpdates: map[string]*string{},
keyToEntryPendingCacheUpdates: make(map[string]*string, rw.maxBatchSize),
maxBatchSize: rw.maxBatchSize,
},
ledgerRetentionWindow: rw.ledgerRetentionWindow,
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-rpc/internal/db/ledgerentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (r ledgerEntryReader) NewTx(ctx context.Context) (LedgerEntryReadTx, error)
if err := txSession.BeginTx(ctx, &sql.TxOptions{ReadOnly: true}); err != nil {
return nil, err
}
localCache := map[string]string{}
localCache := make(map[string]string, len(r.db.ledgerEntryCache))
for k, v := range r.db.ledgerEntryCache {
localCache[k] = v
}
Expand Down

0 comments on commit 6c01757

Please sign in to comment.