First of all, do some profiling to make sure that your process is actually related to computing, and not to I / O binding. That is, your statistics collection is slower than file access. Otherwise, multithreading will be slower than your program, and not speed it up, especially if you are working on a single-core processor (or in the old JVM).
Also think: if your file is located on your hard drive: how do you plan to read? You risk adding delays to finding the hard drive otherwise, stopping all the threads that managed to finish the job, while one thread asks the hard drive to search for position 0x03457000 ...
source
share