• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic