SQLite Forum

SQLite3.exe fails to handle huge multi-line-comment
Login
## Answers

> Why does processing the /* multi-line-comment */ take soooo much time?

The most slowish (O n^2) thing happening with your extreme input is that, almost for each input line of your humongous comment, a realloc is being done for the portion of the SQL collected to that point.

> Can this be improved with next SQLite3 version 3.37 ?

I doubt that the O n^2 behavior will change by then. However, if you were to find a line in shell.c reading <code>
      nAlloc = nSql+nLine+100;
</code>, and change it to <code>
      nAlloc = 3*(nSql+nLine)/2+100;
</code>, you should see a noticeable improvement. This gets to O n*log(n) behavior. Please report back if this solves your problem.

Edited to add: With above change, it's still O n^2. Dunno why, yet.