import java.io.File;
import java.nio.file.LinkOption;
import java.nio.file.Path;

public class RealPathTest {

public static void main(String[] args) throws Exception {
System.out.println("* " + System.getProperty("os.name") + " " + System.getProperty("os.version"));
System.out.println("* " + System.getProperty("java.runtime.name") + " " + System.getProperty("java.runtime.version"));

Path[] files = new Path[10000];
for (int i = 0; i < files.length; i++) {
File f = File.createTempFile("RealPath" + i, ".tmp");
f.deleteOnExit();
files[i] = f.toPath();
}

long t1 = System.currentTimeMillis();
for (Path f : files) {
f.toRealPath();
}
System.out.format("TIME toRealPath(): %,d ms%n", System.currentTimeMillis() - t1);

long t2 = System.currentTimeMillis();
for (Path f : files) {
f.toRealPath(LinkOption.NOFOLLOW_LINKS);
}
System.out.format("TIME toRealPath(LinkOption.NOFOLLOW_LINKS): %,d ms%n", System.currentTimeMillis() - t2);

long t3 = System.currentTimeMillis();
for (Path f : files) {
f.toRealPath();
}
System.out.format("TIME toRealPath(): %,d ms%n", System.currentTimeMillis() - t3);
}

} 