Violator wrote:Manny wrote:please be more specific how much overheads it will add in percents?
When you read from start to end C++ is up to twice as fast, since it doesn't need to do any decoding.
Scroll down to file reading:
http://www.codeproject.com/Articles/212 ... arp-vs-NET
Very interesting article but we have slight different scenario.
First of all it reads text file, so .Net version converting it to UTF-16. You can read file in binary format, it will eliminate the biggest overhead.
The second main difference that you can't read huge files in "whole file at once mode", so we will need to read it by some pieces, and in that test C# is leading more then 5x.
Third difference is about filesystem speed and IOPs, because guy uses file from system cache. Lets calculate.
400kb * 20 times = 8mb
so C++ in whole file mode = 266 MB/s and 666 iops
C++ in per line mode = 66 MB/s and 166 iops - 2kk lines per second
C# in whole file mode = 160 MB/s and 400 iops
and in per line mode = 133 MB/s and 333 iops - 4kk lines per second
in per line mode he has size of block = 24 bytes (400kb*1024/17000lines)
My laptop hdd results:
512 bytes block = 89 iops, 0.05 MB/s, 1900 lines per second
1 MB block = 36 iops, 36 MB/s
as you can see any solution on any language is more efficient than my file storage.
lets take C# block mode, it is 3.6x faster than hdd, 9x faster by iops than hdd, and 2000x !!! faster in lines.
So any way you will be limited by your HDD than by software platform, an even if you have 8x SSD RAID 0, then you will probably win 1-2 seconds on 8GB file. But if we use binary mode then we will have difference in microseconds, instead of seconds.