我的Java IO性能有些问题.
首先,我在这里阅读了关于性能的提示,我试图实现它.
但这是我的问题:
使用小文件(高达400MB),速度非常快.但是我将使用的真实文件大约是30 GB.而且这些文件会像地狱一样慢下来.
它的作用:取2个文件,进行独占或写一个新文件.
BTW:不要担心最后的文件被削减.这只是为了解决我还没有找到的一个小错误.
我希望有人给我一个提示.谢谢.
关心蒂莫
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
public class main {
public static void main(String[] args) throws IOException {
final long start = System.currentTimeMillis();
// Init. FileChannel1
final File file1 = new File("/home/tmann/Downloads/test/1.zip");
final RandomAccessFile fis1 = new RandomAccessFile(file1, "rw");
final FileChannel ch1 = fis1.getChannel();
// Init. FileChannel2
final File file2 = new File("/home/tmann/Downloads/test/2.zip");
final RandomAccessFile fis2 = new RandomAccessFile(file2, "rw");
final FileChannel ch2 = fis2.getChannel();
// …Run Code Online (Sandbox Code Playgroud)