model-writtenrun 2534 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Daniel Verite reported quadratic pgbench script parsing and supplied a patch that deferred line-number calculation until an error needed it, reducing CPU time for his 50,000-statement example from about 5.8 seconds to 0.1 seconds while leaving backslash-command parsing unresolved #1.
- Tom Lane proposed borrowing PL/pgSQL's incremental line tracking and favored that approach over flex's yylineno option because the latter adds scanner overhead #2 #3.
- Daniel explained that the large scripts supported a real comparison of pipeline behavior between pgbench and psql, and that he wanted to increase the statement count further #4.
- Tom supplied a broader replacement that tracked locations in psqlscan, eliminated repeated scans for backslash-command words, and corrected the erroneous line number reported when a script began with a backslash-gset command; his large-script parsing time fell from over ten seconds to roughly fifty milliseconds #5.
- Tom revised the tracker to avoid quadratic behavior even within very long lines and added a separate patch credited to Daniel that calculated locations only after encountering a backslash, also avoiding misleading locations inherited from the preceding SQL semicolon #6.
- Daniel approved the revised submission before either commit landed #7.
- The first patch from #6 landed as c8c74ad7e1 with a local rewrite of substring allocation and trimming plus a comment edit, and the second patch landed unchanged as 6eb8a1a4f9.
- Tom closed the thread by thanking Daniel for reviewing and confirming that both patches had been pushed after polishing, leaving no outstanding work identified in the thread #8.