elodina / go-avro

Apache Avro for Golang
http://elodina.github.io/go-avro/
Apache License 2.0
129 stars 55 forks source link

Faster decoding of arrays in SpecificDatumReader #67

Closed crast closed 8 years ago

crast commented 8 years ago

Implement array decoding using less memory allocation and less array copies but more importantly making the code a bit clearer to read.

Benchmarks (golang 1.5.3; x86-64; OSX)

Before:

BenchmarkSpecificDatumReader_bigArrays-4                5000        246318 ns/op       48544 B/op       2007 allocs/op
BenchmarkSpecificDatumReader_segmented_bigArrays-4      5000        272085 ns/op      130432 B/op       2083 allocs/op

After:

BenchmarkSpecificDatumReader_bigArrays-4               10000        206916 ns/op       40320 B/op       2005 allocs/op
BenchmarkSpecificDatumReader_segmented_bigArrays-4     10000        221691 ns/op       62752 B/op       2086 allocs/op

Yields ~16% improvement on normal big arrays, and 21% on segmented big arrays

serejja commented 8 years ago

Great, thanks!