Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP spanner: optimize array decoding
DO NOT SUBMIT; WORK IN PROGRESS Previously BenchmarkDecodeArray did not call the library code directly, but used a similar function to insulate itself against library change. However, the library code calls stringType() at every iteration, while the benchmark calls the function only once. This commit adds StringDecodeStringArray subbenchmark which calls the library code directly to compare performance numbers. According to the results, saving the result of stringType() makes us 3x faster in the limit. I think we should either copy this improvement to other types, or, as jba@ suggested in 6e42463 move to a generic array decode function. While the generic function is slower, it would make it harder for such silly perf bugs to sneek through. Benchmarks run on go1.9 benchmark old ns/op new ns/op delta BenchmarkDecodeArray/1/StringDecodeStringArray-12 85.1 89.1 +4.70% BenchmarkDecodeArray/1/StringDirect-12 80.1 83.1 +3.75% BenchmarkDecodeArray/10/StringDecodeStringArray-12 547 239 -56.31% BenchmarkDecodeArray/10/StringDirect-12 233 236 +1.29% BenchmarkDecodeArray/100/StringDecodeStringArray-12 4902 1518 -69.03% BenchmarkDecodeArray/100/StringDirect-12 1488 1503 +1.01% BenchmarkDecodeArray/1000/StringDecodeStringArray-12 48642 13952 -71.32% BenchmarkDecodeArray/1000/StringDirect-12 13808 13957 +1.08% Change-Id: Ib2d5dfe1c490fe1dcd8f7cf240e46d60eba2b8aa Reviewed-on: https://code-review.googlesource.com/16610 Reviewed-by: kokoro <[email protected]> Reviewed-by: Jonathan Amsterdam <[email protected]>
- Loading branch information