24.8.13

Use Path.toFile.createNewFile() instead of Files.createFile(Path p) for performance sensitive system.

According to my own test with Files.createFile(Path p) on existing file, for 1 million files:

Using Files.createFile(Path p) with IOException:
  24,632,879,688 nano seconds
But using Path.toFile().createNewFile():
  7,836,679,463 nano seconds.
The former solution spends 3 times of the process time.

No comments: