-
Knut Anders Hatlen authored
When retrieving large result sets containing DECIMAL columns from a secondary engine, conversion of DECIMAL values to strings for transport over the text protocol is a bottleneck. This patch improves the performance of the DECIMAL to string conversion as follows: - decimal2string() uses the optimized write_digits() and count_digits() functions introduced in bug#30528427. - Protocol_text::store_decimal() no longer uses an intermediate local buffer, and instead writes the string directly into the destination buffer. - Protocol_text::store_decimal() uses decimal2string() directly instead of going through the my_decimal2string() wrapper. The extra code in the wrapper is only useful if the destination buffer could be too small to hold the full string, and store_decimal() has allocated a large enough buffer to hold the widest DECIMAL value. Microbenchmarks (64-bit, Intel Core i7-4770 3.4 GHz, GCC 8.3.0): BM_Decimal2String 3908 ns/iter -> 2374 ns/iter BM_Decimal2Bin_10_2 19 ns/iter -> 17 ns/iter BM_Protocol_binary_store_decimal 119 ns/iter -> 52 ns/iter Change-Id: I76867b3e7ae93251c2fae716c39fc2f204d8a9c8
Knut Anders Hatlen authoredWhen retrieving large result sets containing DECIMAL columns from a secondary engine, conversion of DECIMAL values to strings for transport over the text protocol is a bottleneck. This patch improves the performance of the DECIMAL to string conversion as follows: - decimal2string() uses the optimized write_digits() and count_digits() functions introduced in bug#30528427. - Protocol_text::store_decimal() no longer uses an intermediate local buffer, and instead writes the string directly into the destination buffer. - Protocol_text::store_decimal() uses decimal2string() directly instead of going through the my_decimal2string() wrapper. The extra code in the wrapper is only useful if the destination buffer could be too small to hold the full string, and store_decimal() has allocated a large enough buffer to hold the widest DECIMAL value. Microbenchmarks (64-bit, Intel Core i7-4770 3.4 GHz, GCC 8.3.0): BM_Decimal2String 3908 ns/iter -> 2374 ns/iter BM_Decimal2Bin_10_2 19 ns/iter -> 17 ns/iter BM_Protocol_binary_store_decimal 119 ns/iter -> 52 ns/iter Change-Id: I76867b3e7ae93251c2fae716c39fc2f204d8a9c8
Loading