• Alexander Barkov's avatar
    MDEV-23568 Improve performance of my_{time|date|datetime}_to_str() · c14ecc75
    Alexander Barkov authored
    This patch improves functions my_xxx_to_str() using the idea
    introduced in this change in MySQL-8.0:
    
      commit 8d10f2fff6bbdea7f436b868ebb5fd811defc68a
      Author: Knut Anders Hatlen <knut.hatlen@oracle.com>
      Date:   Thu Oct 10 13:55:07 2019 +0200
        Bug#30472888: IMPROVE THE PERFORMANCE OF INTEGER HANDLING IN THE TEXT PROTOCOL
    
    The new way prints 2 digits at a time and demonstrates a very impressing query time reduce:
    10% to 38%, depending on the exact data type and the number of fractional digits:
    
      SELECT BENCHMARK(10*1000*1000,CONCAT(TIME'10:20:30'));
      SELECT BENCHMARK(10*1000*1000,CONCAT(TIME'10:20:30.123456'));
      SELECT BENCHMARK(10*1000*1000,CONCAT(DATE'2001-01-01'));
      SELECT BENCHMARK(10*1000*1000,CONCAT(TIMESTAMP'2001-01-01 10:20:30'));
      SELECT BENCHMARK(10*1000*1000,CONCAT(TIMESTAMP'2001-01-01 10:20:30.123456'));
    
    See MDEV for details on the benchmark results.
    c14ecc75
my_time.c 59.9 KB