model-writtenrun 5882 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- John Naylor proposed speeding up character-position calculation after substring matches near the end of long strings; his prototype compared a DFA, a lookup table, UTF-8 length inlining, and an ASCII fast path, with the latter two performing best in his initial tests #1.
- John Naylor reworked the prototype into three patches that introduced a shared inline UTF-8 helper, changed text_position_get_match_pos() to call pg_mbstrlen_with_len(), and specialized that routine for UTF-8; unexpectedly poor ASCII results from the last patch left him hesitant to proceed #3.
- Testing on a newer CPU eliminated the specialization regression, prompting John Naylor to focus on validating the first two patches across compilers and architectures; he also found that the refactor alone improved performance #4.
- After testing four machines, John Naylor concluded that only the pg_mbstrlen_with_len() refactor consistently improved performance and announced his intention to commit it, leaving the UTF-8 optimizations out because they could make performance better or worse #5.
- John Naylor subsequently committed the second patch from the revised series unchanged as b31e3f5613, documenting a stable 10–20% worst-case improvement across server encodings; the other two patches from #3 were not included.