This change significantly reduces the number of allocations during ledger parsing, requiring less garbage collection, and speeding up the application. As you can see below, this is approximately 3 times faster and performs 80% fewer allocations.
Before
go test -run=XXX -bench=. -benchmem ledger
goos: darwin
goarch: amd64
pkg: ledger
BenchmarkParseLedger-8 100000 11386 ns/op 6376 B/op 29 allocs/op
After
go test -run=XXX -bench=. -benchmem ledger
goos: darwin
goarch: amd64
pkg: ledger
BenchmarkParseLedger-8 300000 4305 ns/op 4336 B/op 6 allocs/op
This change significantly reduces the number of allocations during ledger parsing, requiring less garbage collection, and speeding up the application. As you can see below, this is approximately 3 times faster and performs 80% fewer allocations.
Before
go test -run=XXX -bench=. -benchmem ledger goos: darwin goarch: amd64 pkg: ledger BenchmarkParseLedger-8 100000 11386 ns/op 6376 B/op 29 allocs/op
After
go test -run=XXX -bench=. -benchmem ledger goos: darwin goarch: amd64 pkg: ledger BenchmarkParseLedger-8 300000 4305 ns/op 4336 B/op 6 allocs/op