From: Batuhan Taskaya Date: Sun, 5 Dec 2021 21:03:48 +0000 (+0300) Subject: perf: drop the initial stack copy (#2670) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/28ab82aab013978b7ed91bda816de3d41385f260?ds=sidebyside perf: drop the initial stack copy (#2670) Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com> --- diff --git a/CHANGES.md b/CHANGES.md index 097725e..434f809 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -26,6 +26,8 @@ - Fix styling of starred expressions inside `match` subject (#2667) - Fix parser error location on invalid syntax in a `match` statement (#2649) - Fix Python 3.10 support on platforms without ProcessPoolExecutor (#2631) +- Improve parsing performance on code that uses `match` under `--target-version py310` + up to ~50% (#2670) ### Packaging diff --git a/src/blib2to3/pgen2/parse.py b/src/blib2to3/pgen2/parse.py index 792e8e6..e5dad3a 100644 --- a/src/blib2to3/pgen2/parse.py +++ b/src/blib2to3/pgen2/parse.py @@ -53,7 +53,7 @@ class Recorder: self.context = context # not really matter self._dead_ilabels: Set[int] = set() - self._start_point = copy.deepcopy(self.parser.stack) + self._start_point = self.parser.stack self._points = {ilabel: copy.deepcopy(self._start_point) for ilabel in ilabels} @property