diff options
author | Amethyst Reese <amethyst@n7.gg> | 2024-03-01 10:52:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-01 10:52:53 (GMT) |
commit | 4a630980328b67f0aba6a04c3950aa9dbd532895 (patch) | |
tree | 5dcd78b09e4967f71482ecdd4de9ed50eaa21038 /Python/getcompiler.c | |
parent | 7b4794319c56b6b00e852c745af50fd95bd1a550 (diff) | |
download | cpython-4a630980328b67f0aba6a04c3950aa9dbd532895.zip cpython-4a630980328b67f0aba6a04c3950aa9dbd532895.tar.gz cpython-4a630980328b67f0aba6a04c3950aa9dbd532895.tar.bz2 |
gh-116159: argparse: performance improvement parsing large number of options (#116162)
When parsing positional vs optional arguments, the use of min with a
list comprehension inside of a loop results in quadratic time based
on the number of optional arguments given. When combined with use of
prefix based argument files and a large number of optional flags, this
can result in extremely slow parsing behavior.
This replaces the min call with a simple loop with a short circuit to
break at the next optional argument.
Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
Diffstat (limited to 'Python/getcompiler.c')
0 files changed, 0 insertions, 0 deletions