http://nadeausoftware.com/articles/2008/02/java_tip_how_read_files_quickly
For the best Java read performance, there are four things to remember:
- Minimize I/O operations by reading an array at a time, not a byte at a time. An 8Kbyte array is a good size.
- Minimize method calls by getting data an array at a time, not a byte at a time. Use array indexing to get at bytes in the array.
- Minimize thread synchronization locks if you don't need thread safety. Either make fewer method calls to a thread-safe class, or use a non-thread-safe class like
FileChannel
andMappedByteBuffer
.- Minimize data copying between the JVM/OS, internal buffers, and application arrays. Use
FileChannel
with memory mapping, or a direct or wrapped arrayByteBuffer
Posted via email from miner49r
No comments:
Post a Comment