开发者

What would be "faster" when dealing with input and output?

开发者 https://www.devze.com 2023-02-08 20:03 出处:网络
A simple program asking for user input could use datainputstream or sca开发者_如何学Cnner. Which would be faster? Datainputstream is binary so it may be faster? Is it in opinion? I\'m just curious bec

A simple program asking for user input could use datainputstream or sca开发者_如何学Cnner. Which would be faster? Datainputstream is binary so it may be faster? Is it in opinion? I'm just curious because I'm building a program that I want to be efficient as possible.


If you are taking input from a human being you shouldn't worry about optimizing the method in which you retrieve it.

The amount of time it takes a user to type will be the only substantial bottleneck in your program. People are many times slower than computers, so don't worry about making your program fast.

What you should worry about is making it easier for people to enter data into your program. That is the only way to substantially speed up human input.

(That being said, I prefer the Scanner class for reading input from a user.)

0

精彩评论

暂无评论...
验证码 换一张
取 消