If I use QString methods, my program are going to be slower that if I use String STL lib ?
Thanks
If I use QString methods, my program are going to be slower that if I use String STL lib ?
Thanks
QString will be in many cases a bit slower than std::string because it operates on Unicode strings and not 8-bit strings but in other cases it will be faster because of better algorithmics and API. So the bottom line is that it depends on the usecase.
That's a great way of entering a Qt community :->
I recommend to optimize for performance only, where it matters. If something scales with the input and there is something to gain from a performance boost.
That is rarely going to be string handling. I just wrote a small qt application reading all my source code/text files into memory and make them searchable. With hundreds of MBytes of QStrings this is still blazing fast. I qCompress'ed them in memory to keep memory usage acceptable, because obviously otherwise Unicode blows everything up quite a bit.
Otherwise optimize code readability. That will leave you more time to do important stuff.
Joh
Bookmarks