Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pretty print list too slow #5347

Closed
rwst opened this issue Mar 13, 2014 · 4 comments · Fixed by #5376
Closed

pretty print list too slow #5347

rwst opened this issue Mar 13, 2014 · 4 comments · Fixed by #5376
Milestone

Comments

@rwst
Copy link

rwst commented Mar 13, 2014

It seems ipython's behaviour is very different if I say:

print range(10**6)       # case 1, fraction of a second, output in ONE line

range(10**6)             # case 2, ten seconds, 10^6 lines

and the difference is not due to the actual output, but presumably the formatting of the one-value-per-line output.

As this is a factor of about 10x (not counting the actual output), and growing with list size, there appears to be a problem because this is unexpected by the user. It was only through debugging, then web search, and a stackoverflow comment that I found the %pprint magic which is nowhere documented. So even if you dismiss this as bug or enhancement, this ticket should add helpful documentation.

@rwst
Copy link
Author

rwst commented Mar 13, 2014

@minrk
Copy link
Member

minrk commented Mar 13, 2014

I think we could cap the size for pretty printing of lists, dicts, etc. easily enough.

@jankatins
Copy link
Contributor

See also here: #2747 (also "one value per line", one print per loop)

@minrk
Copy link
Member

minrk commented Mar 18, 2014

While its symptoms are similar, #2747 is actually unrelated. Here, the issue is in IPython.lib.pretty formatting the output on the kernel (see #5376 for a proposed fix). #2747 is a performance issue in the notebook UI's javascript, when it is handling the many messages produced by print (or more precisely stdout.flush).

@minrk minrk added this to the 2.0 milestone Mar 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants