You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Speed up pprint on deeply nested containers #161114
pprint.pformat() decides whether a container fits on the current line by building its complete one-line repr, and when it doesn't, it repeats that for each child. For deeply nested data the innermost items are therefore formatted once per enclosing level, so the time grows with size times depth.
The nested version takes about 40x longer than the flat one (0.07 s vs 2.6 s on a release build). The fit check can stop once the line is full, which makes it cost at most the line width per level; output stays the same.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Activity