What is faster in Java for reading / parsing console input, scanner or BufferedReader?

I need to process a data processor that can handle more than 2.5 MB / s of input from STDIN and output the number in STDOUT. What happens faster to use BufferedReader, and then conversion to data types or scanner and nextInt () or nextFloat ()?

EMPIRICAL TEST RESULTS: BufferedReader and conversion are a little faster, but nothing too significant.

Thankyou!

+5
source share
2 answers

The answer most likely does not matter how you do it in terms of performance. (And there is no way that anyone can enter at a speed of 2.5 MB per second on the console!)

, , , , . ( stdin), , , ... .

, , . , , , , , ... . (, , Java.)

+6

BufferedReader . Scanner .

2,5 / BufferedReader. , Scanner. 8 1

BufferedReader → →

+1

All Articles