Java NIO Performance vs DotNet IO

Does anyone know the difference in performance between Java NIO Performance and DotNet IO.

Reading this question, it looks like standard Java-IO and DotNet-IO have very similar IO performance.

What interests me is that the guys from Java claim that bulk copying files, operations on a file server ... etc. should be much faster due to access to file channels, etc. in Java-NIO.

Is it possible that the performance of java.nio better than the DotNet System.IO .

Thanks.

+4
source share
2 answers

how much the file is copied, there should be no significant differences, no matter which platform or api you use. The neck of the bottle is a spinning disk and searching for the head on the hard disk. *

what should happen is to move the contents of the hard drive to some memory, and then write to the hard drive. with the traditional java io thread, there will be additional copies of memory. this is still not significant waste compared to disk speed.

this is easy to verify, FileChannel.transferTo / From cannot beat the old way of ellipsis I / O.

(*), of course, now there are much faster disks, but for now we define the disk as the next slower storage after memory, the argument is saved.

(**) we could call a virtual disk a disk, which is actually located in the main memory. then a copy of memory is the neck of the bottle, and the argument no longer holds.

+2
source

Actually I cannot answer this, but I can think freely ...

.. both Java-File-IO and .Net must use OS operations substitution to access files, and file access is always associated with IO, not CPU binding. This means that drives are slower than CPU and memory.

What this will mean is that Java-File-IO and .Net should be the same in terms of performance.

When it comes to Socket communications, Java has done a terrible job and actually just ignored the Posix standard and did not use the "select" OS call. This was fixed in Java NIO with the introduction of "channels", which no more than actually supports the underlying architecture. Before you needed to allocate a thread for each socket that you read, there was a terrible loss of resources.

Since .NET is newer, then Java, I would believe that they never fell into this trap and did not support it from the very beginning. But I did not use .Net, so I can say, I can’t guess.

With regard to Socket communications, in both cases, Java-NIO and .Net System.IO must both be network-connected before they transfer to the CPU in any way. Therefore, I do not think that someone would be faster than another.

+3
source

All Articles