New submission from Lysandros Nikolaou <lisandros...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue42123>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to