bad I/O performance in BufferedInputStream

J

Jimmy Zhang

hi,
I am trying to read 4 files into memory, I am getting horrible performance.
Anyone has suggestions on how to imporve the performance. notice that I
have already used BufferedInputStream wherever I can.

Am I better off open and read from one file or from many different files??

Thanks,
Jimmy


File f = new File(vtd);
int size = ((int) f.length()) ;

vtdTokenBuffer = new LongBuffer();
DataInputStream bi = new DataInputStream(new BufferedInputStream(new
FileInputStream(vtd)));
size = size>>3;

for(int i = 0;i<(size);i++)
{
long l = bi.readLong();
}

bi.close();

f = new File(l1);
size = (int) f.length();

bi = new DataInputStream(new BufferedInputStream(new
FileInputStream(l1)));
size = size>>3;
for(int i = 0;i<(size);i++)
{
long l = bi.readLong();
//System.out.println(" Level 1 "+Long.toHexString(l));
//cacheLevelOne.append(l);
}
bi.close();

f = new File(l2);
size = (int) f.length();

bi = new DataInputStream(new BufferedInputStream(new
FileInputStream(l2)));
size = size >>3;
for(int i = 0;i<(size);i++)
{
bi.readLong();
}
bi.close();

f = new File(l3);
size = (int) f.length();
cacheLevelThree = new IntBuffer();
bi = new DataInputStream(new BufferedInputStream(new
FileInputStream(l3)));
size = size>>2;
for(int i = 0;i<(size);i++)
{
int l = bi.readInt();
}
bi.close();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top