Make ISO 8601 timestamp conversion fast
Table of Contents
This page is a capture in the inbox bucket of the product backlog — a pre-sprint idea, not yet pulled into a sprint as a story.
1. What
Replace the conversion in ores::platform::time::datetime::to_iso8601_utc and
from_iso8601_utc with a fixed-format writer and reader for the one wire shape
the time architecture defines. Keep the same text, byte for byte, so that no
message and no stored value changes.
2. Why
The functions take 764 ns to format and 960 ns to parse a timestamp. Every message with a timestamp pays this for each one, through reflect-cpp and through a generated codec alike. For a list of 100 change reason categories, the conversions are 80–90% of the time to encode or decode the message. A fixed-format writer and reader would take tens of nanoseconds, so this one change could make every such message several times faster. The repository mappers use the same functions for each row they read.
3. References
- Compare generated JSON and MessagePack codecs with reflect-cpp: the
measurements, in its
* Notesandevidence/codec_bench/conversions.cpp.