nene / sql-parser-cst

Parses SQL into Concrete Syntax Tree (CST)
GNU General Public License v2.0
115 stars 7 forks source link

`mysql` mode is slow with `paren_expr` #38

Closed osaton closed 1 year ago

osaton commented 1 year ago

First, thank you for developing this great library!

I noticed that the parser is exponentially slower with mysql vs nosql when parenthesis are used.

parse('SELECT (((((1)))))', {
  dialect: 'mysql'
}); // 854 ms

vs.

parse('SELECT (((((1)))))', {
  dialect: 'sqlite'
}); // 36 ms

This was tested with version 0.16.

I know MySQL mode is a work in progress but just thought you'd like to know.

nene commented 1 year ago

Thanks for reporting. Haven't been monitoring the performance lately, and looks like things have gone a bit off rail. Will look into it. Thanks for sharing.

nene commented 1 year ago

The performance should now be greatly improved in 0.17.1 release.

The parsing of these nested parenthesis is still slower than I'd like it to be, and the MySQL/MariaDB parsing is also a touch slower than others, but at least there's no such huge difference as before.