I'm trying to figure out which is faster, as well as learn how to benchmark. Do you think this is an accurate way to test QFile VS ifstream?
Speed and optimization are 2 important factors for every program. They are more programmer dependent than language or implementation dependent. Many times when we need optimizations we think that current language or implementation is not optimized.
ifstream is a standard class in C++ and I think QFile uses that. The speed and the ratio you want to measure can be described and measured in a defined environment and it is better you describe the case you are facing.
Another important point, I can't understand why speed of a file operator class is important to you ?! Many file related operations can and should be done in the memory and traps to hard disks should stay minimum. So in an ideal situatuion I think there is no difference between
QFile or any slower framework for file access. For you and in general, both of these classes use native OS libraries. I think
ifstream is a wrapper on native OS libraries and
QFile is a thicker wrapper because of additional attributes. But I don't think this is very important when you want to use memory in an optimized and managed way.