[New-bugs-announce] [issue42123] Run the two times, only enable invalid_* rules on the second run

Lysandros Nikolaou report at bugs.python.org
Thu Oct 22 19:35:43 EDT 2020


New submission from Lysandros Nikolaou <lisandrosnik at gmail.com>:

We can avoid having to go through all the invalid rules (which might be a significant performance boost, since these may call expensive rules like primary or others), if we run the parser two times.

On the first run, all the invalid rules are disabled and do not get expanded. If a parse failure occurs anywhere, then we run the parser a second time with all these rules enabled, in order to get the correct error message.

Some benchmarking by Pablo show a ~4% speedup in the stdlib benchmark and a ~10% in the xxl benchmark.

----------
assignee: lys.nikolaou
components: Interpreter Core
messages: 379384
nosy: gvanrossum, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Run the two times, only enable invalid_* rules on the second run
type: performance
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42123>
_______________________________________


More information about the New-bugs-announce mailing list