+33
−13
+130
−0
+19
−2
Loading
(*conn).parseTime ran on every TEXT-stored DATETIME / DATE / TIMESTAMP
column read in Next(). The function tried (*conn).parseTimeString first
and then walked parseTimeFormats[0..6] sequentially until time.Parse
matched the row's value. For the canonical SQLite TEXT datetime format
("2006-01-02 15:04:05.999999999", index 2) every row paid two failed
time.Parse attempts in the warmup, plus the one successful match. Each
failed Parse allocates a ParseError, so the per-row cost on a steady
1000-row scan was ~5 allocs per row from the format-search alone.
Add a sticky per-column hint cache:
- rows.parseFmtIdx []int8, sized once at newRows() to the column count,
initialised to -1 (no match recorded).
- (*conn).parseTime now takes hintIdx int and returns the index that
actually matched (or -1 when parseTimeString matched / all formats
failed). It tries hintIdx first if in range, then walks the list
skipping the index it just tried.
...