• 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
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Performance improvement beyond BufferedReader & BufferedInputStream

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

Is there a way to improve performance of File I/O in java beyond using BufferedReaders and BufferedInputStreams?

I have to write a piece of code which searches for some string in a bunch of text and binary files. I have written this using BufferedReader for reading text files and BufferedInputStream for binary files. Typically I read these files in chunks of 64K bytes or chars of data.

This code takes approximately 10 minutes to parse around 1.5GB of data. Most of the execution time is spent in reading the files. Is there a way I can improve this performance? One option I can think of is invoking some code written in C/C++ for using JNI. I doubt even this approach will yield some significant performance improvement.

(I am using JDK1.4 and the system on which I am testing is a Windows XP box with 3 GHz processor and 1GB of RAM).

Thanks in advance for any suggestion/help.
Basu.
(edited: changed the subject and question a bit. hope to get some response this time :-) )
[ March 31, 2006: Message edited by: Basudev Agrawal ]
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you need the "new" i/o (java.nio.*), which includes memory mapping of files for faster reads/writes.

i'm on the same search myself, actually. there are plenty of "high-level" overviews of this topic but precious little detail. i need to be able to parse and process 1+ GB files in real time. ;-)

Here's a tidbit:

File Management Made Easier

thanks.

mp
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic