Re: benchmarking Flex practices
От | John Naylor |
---|---|
Тема | Re: benchmarking Flex practices |
Дата | |
Msg-id | CACPNZCsuAM1vyBo8jgTRBhOz+bht1=GcxceMoxwNGCwZxUGBtA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: benchmarking Flex practices (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: benchmarking Flex practices
|
Список | pgsql-hackers |
On Wed, Jul 10, 2019 at 3:15 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: > > John Naylor <john.naylor@2ndquadrant.com> writes: > > [ v4 patches for trimming lexer table size ] > > I reviewed this and it looks pretty solid. One gripe I have is > that I think it's best to limit backup-prevention tokens such as > quotecontinuefail so that they match only exact prefixes of their > "success" tokens. This seems clearer to me, and in at least some cases > it can save a few flex states. The attached v5 patch does it like that > and gets us down to 22331 states (from 23696). In some places it looks > like you did that to avoid writing an explicit "{other}" match rule for > an exclusive state, but I think it's better for readability and > separation of concerns to go ahead and have those explicit rules > (and it seems to make no difference table-size-wise). Looks good to me. > We still need to propagate these changes into the psql and ecpg lexers, > but I assume you were waiting to agree on the core patch before touching > those. If you're good with the changes I made here, have at it. I just made a couple additional cosmetic adjustments that made sense when diff'ing with the other scanners. Make check-world passes. Some notes: The pre-existing ecpg var "state_before" was a bit confusing when combined with the new var "state_before_quote_stop", and the former is also used with C-comments, so I decided to go with "state_before_lit_start" and "state_before_lit_stop". Even though comments aren't literals, it's less of a stretch than referring to quotes. To keep things consistent, I went with the latter var in psql and core. To get the regression tests to pass, I had to add this: psql_scan_in_quote(PsqlScanState state) { - return state->start_state != INITIAL; + return state->start_state != INITIAL && + state->start_state != xqs; } ...otherwise with parens we sometimes don't get the right prompt and we get empty lines echoed. Adding xuend and xuchar here didn't seem to make a difference. There might be something subtle I'm missing, so I thought I'd mention it. With the unicode escape rules brought over, the diff to the ecpg scanner is much cleaner now. The diff for C-comment rules were still pretty messy in comparison, so I made an attempt to clean that up in 0002. A bit off-topic, but I thought I should offer that while it was fresh in my head. -- John Naylor https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Вложения
В списке pgsql-hackers по дате отправления: