Scala 中 println 的替代方案

Alternative for println in Scala

我需要在控制台上打印大量数据(大约 100 MB)。为此使用 println 在 IntelliJ 上失败得很惨。 有没有像 console.log 这样的替代方法可以处理和显示这些数据而不会滞后和减慢速度?

提前致谢!

你可以buffer, and perhaps bypass character encoding. It's also worth looking at the IntelliJ settings, particularly if you don't see this problem when running from the commandline - perhaps IntelliJ is offering some functionality in its console (e.g. highlight errors, link stack traces to line numbers) that involves scanning every line. You might also worry about word wrapping in your console

(也就是说,我不确定您如何期望从 100MB 的打印中理解任何内容 - 如果您需要查看 "see the pattern" 的概述,请尝试让代码看到模式和你一样)