ZMySQLDA: Optimise date & datetime parsing in results.
A pprofile run shows DateTime_or_None costing 3ms per value (including all callees). While this may seem low, it is common to receive hundreds of such values in single query results (ex: web mode document & webpage lookups), so the total time spent parting dates per query can become significantly larger than the time to execute the query itself. In the case of this measure setup, 504 dates were processed for a total of 1.5 seconds. DateTime is slow to parse strings because it cannot rely on a pre-known format. With MySQL/MariaDB, the format is know for those column types, so implement specific parsing to get better performance. On the same setup, pprofile run shows a parsing time of 72µs per value in DATETIME_to_DateTime_or_None, or 39ms total. DATE_to_DateTime_or_None should not deviate significantly from this.
Showing