Topic
No replies
SystemAdmin
SystemAdmin
2768 Posts
ACCEPTED ANSWER

Pinned topic Performance of reading binary files?

‏2009-12-29T10:50:48Z |
Hi,

I'm not sure that http://www.ibm.com/developerworks/forums/thread.jspa?threadID=313895 was posted in appropriate place, so duplicating it here also.

I'm experiencing considerable performance problems while reading relatively large binary files (written by C++ application) in java application running on AIX box.
I need to retrieve a list of items from 140MB binary file and I'm using java nio FileChannel:

FileChannel fc = new FileInputStream(fileName).getChannel();
Long size = fc.size()/RECORD_SIZE;//RECORD_SIZE = 704 bytes
MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
for (long i = 0; i < size; i++){
//extracting one item
Item = new Item();
...
item.sedId(bb.getInt());
...
}

My laptop with Windows is able to accomplish described task in less them 2 seconds but on AIX box it takes up to 8 seconds.

Does anybody have any idea on what I'm doing wrong? Or how can performance be improved?

Thanks in advance,
Andrei

AIX hardware configuration:
Processor Implementation Mode: POWER 5
Processor Version: PV_5_2
Number Of Processors: 8
Processor Clock Speed: 1499 MHz
CPU Type: 64-bit
Kernel Type: 64-bit
Memory Size: 31872 MB
Good Memory Size: 31872 MB
Full Core: false