BufferedReader vs. Scanner
Author |
Message |
blackhawk_prince
|
Posted: Tue Jul 15, 2008 8:43 pm Post subject: BufferedReader vs. Scanner |
|
|
Hi I am currently trying to improve the efficiency of my code. What is the major differences between Scanner and BufferedReader for reading form a text file (efficiency wise) Also does anyone know a webpage with contests or tutorial for improving in contests. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
gitoxa
![](http://compsci.ca/v3/uploads/user_avatars/125344263047f801d546bcb.jpg)
|
Posted: Tue Jul 15, 2008 9:30 pm Post subject: RE:BufferedReader vs. Scanner |
|
|
I'm not too familiar with Java, but as for the second part, the only real way to improve at contests is to do them. There's no real "tutorial" for them. |
|
|
|
|
![](images/spacer.gif) |
Nick
![](http://compsci.ca/v3/uploads/user_avatars/19644337547e837b41d67a.png)
|
Posted: Tue Jul 15, 2008 9:53 pm Post subject: RE:BufferedReader vs. Scanner |
|
|
I think he means a contest of who can improve the code better, not improving on doing contests |
|
|
|
|
![](images/spacer.gif) |
DemonWasp
|
Posted: Wed Jul 16, 2008 9:15 am Post subject: RE:BufferedReader vs. Scanner |
|
|
Both Scanner and BufferedReader are quite efficient for reading files. Unless you have an extraordinarily large text file, either should be serviceable. The main difference is that the input methods in Scanner are generally easier to use, though of course that depends on exactly what you're coding.
If you want to make your program run faster, you have to figure out what it's spending most of its time doing / spending the most memory on. Then you can make those parts faster, without wasting your time on parts that don't need it. Look into a piece of software called a "profiler", that may help you find out what your program is spending all its time doing. |
|
|
|
|
![](images/spacer.gif) |
|
|