1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-08 00:28:29 +03:00
Files
mariadb/sql-common/my_time.c
Alexander Barkov 48ab5a4997 Part2: MDEV-23568 Improve performance of my_{time|date|datetime}_to_str()
As an additional improvement, let's store string representations of
the numbers using an array uint16[256] instead of char[512].
This allows to use int2store(), which copies two bytes at a time on x86,
instead of copying the two bytes with digits one-by-one.

This change gives an additional 7% to 26% query time reduce for:
    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'));

The total time reduce (part1 + part2) is now between 15% to 38%
for these queries.
2020-09-03 06:03:54 +04:00

62 KiB