Skip to content

Conversation

@osyoyu
Copy link

@osyoyu osyoyu commented Nov 13, 2023

Inspecting large objects may take a long time since IRB colors the entire output of #inspect all at once.
This patch lets IRB to give up coloring after a certain time and fall back to non-colored output.
Changes can be observed by inspecting large Arrays, for example [1] * 1000000.

The default timeout is 2 seconds, but this can be configured through IRB.conf[:INSPECT_COLORING_TIMEOUT].
Passing nil to this option will disable timeouts (IRB will never fall back to non-colored output).

Inspecting large objects may take a long time since IRB colors
the entire output of #inspect all at once.
This patch lets IRB to give up coloring after a certain time and fall
back to non-colored output.
Changes can be observed by inspecting large Arrays, for example
`[1] * 1000000`.

The default timeout is 2 seconds, but this can be configured through
`IRB.conf[:INSPECT_COLORING_TIMEOUT]`.
Passing nil to this option will disable timeouts (IRB will never fall
back to non-colored output).
@st0012
Copy link
Member

st0012 commented Nov 18, 2023

Thanks for the PR 👍
However, it will not be the best solution to the problem because using timeout will cause hanging problems with debug for the irb:rdbg integration. See ruby/debug#877

Maybe we should improve colour printer instead?

@tompng
Copy link
Member

tompng commented Jan 21, 2025

Thank you for this pull request and also for raising this issue.
The problem is reduced with another approach in #1040, by showing preview of first page quickly.

@tompng tompng closed this Jan 21, 2025
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 this pull request may close these issues.

3 participants