3

From time to time I accidentally let large expressions like RandomReal[1., {10^5, 10, 10}] reach the front end. The computation of the result is quite fast (AbsoluteTiming gives 0.0896609), but the kernel will still take a very long time, just to finally display the 'large output' widget.

Sometimes I can abort the "output-computation" to avoid waiting, but I cannot know when the actual computation that I want to finish ends.

Is there a way to have the front-end do something different on large output? Maybe applying something like Short to large results instead of the 'large output' widget, though Short also seems to be slow. Dimensions might be preferable.

Are there any hooks for this?

masterxilo
  • 5,739
  • 17
  • 39

1 Answers1

2

This can be of help

$PrePrint = If[ByteCount[#] > 10^6, Shallow[#, 1], #] &

Maybe something more fancy is needed to pass larger Graphics, it is up to you.

You can put it init.m analogously to: What bug fixes can be implemented in init.m?

Kuba
  • 136,707
  • 13
  • 279
  • 740