Alternative for println in Scala
Asked Answered
A

1

8

I am required to print huge amounts of data ( in the order of a few 100 MBs) on the console. Using println for this is failing miserably on IntelliJ. Is there any alternative like console.log which can handle and display this data without lagging and slowing down?

Thanks in advance!

Antigone answered 20/1, 2015 at 11:57 Comment(4)
Is the user expected to read all this? If not (as seems probable) write it to a file. I suspect the slowdown is IntelliJ - a test is run from the command lineFootslog
A user is supposed to read but I need to see. The content is basically avro of a huge size which I need to see for checking and analyzing certain things. It is a test.Antigone
related - #4438215Ruffianism
Are you calling println on a 100MB string? Or calling it in a loop? How have you identified that println is the issue?Cheju
B
2

You can 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

(That said, I'm not sure how you expect to understand anything from 100MB of printing - if it's something you need to look at an overview of to "see the pattern", try making code see the pattern the same way you do)

Bulger answered 20/1, 2015 at 13:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.