• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Reading large data

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I want to read large amount of data (5 Lakh lines of data) from a file within a time limit of 1 Sec. I tried to use buffered reader, but it is taking more than 9 Sec. Is there any other efficient api available in java for reading large amount of data?

Thanks in advance.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Obviously reading from a file is constrained by hardware, so the answer is probably to get faster hardware.
Using streams will probably be faster than using a reader because readers do codepage conversion. Of course, you lose that convenient readLine() method.
RandomAccessFile has a readLine() method, but it doesn't support the full Unicode charset. I don't know if it's faster.
The "new" IO classes may offer other options. For the most part, they introduce functionality which was not available in the "old" io classes and the old io classes actually use NIO under the covers, so performance may or may not be better.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic