black icon indicating copy to clipboard operation
black copied to clipboard

Large (4.6MB) parser test code takes 4+ minutes to check.

Open jorisgeer opened this issue 3 years ago • 0 comments

Running Black --check on parser test code as documented in PP-617 on a relatively new Macbook takes 4.45 minutes.

To Reproduce

time python3 -m black --check test.py

Expected behavior

Processed in a couple of seconds.

Environment

Macbook pro 2019 running Linux Mint 20. CPython 3.9.6 Black 22.6.0

Additional context

Excerpt from PEP-617 :

The first timings are for our canonical test file, which has 100,000 lines endlessly repeating the following three lines:

1 + 2 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + ((((((11 * 12 * 13 * 14 * 15 + 16 * 17 + 18 * 19 * 20))))))
2*3 + 4*5*6
12 + (2 * 3 * 4 * 5 + 6 + 7 * 8)

Parsing and converting to ast.AST takes 6.34 seconds, max RSS 1029 MiB.

jorisgeer avatar Jul 19 '22 08:07 jorisgeer