Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTextStream readAll issue

QTextStream readAll issue

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 302 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MegamouseM Offline
    MegamouseM Offline
    Megamouse
    wrote on last edited by Megamouse
    #1

    Hi,

    Does anyone else have issues with QTextStream::readAll in Qt 6.5.2 (on MSCV) ?
    It seems to be stuck when I try to read a 180mb file, which doesn't happen in Qt 5.15.2.
    It also seems to be significantly slower in general than in Qt 5.
    A 20mb file which is read almost instantly in Qt5 takes 4-5 seconds in the Qt 6 build.

    It seems like these two issues may be intertwined.
    Maybe the read time is simply increased exponentially with the file size.

    This somehow reminds me of the hilarous GTA5 online bug from a while back that unnecessarily caused ridiculous loading times for years.

    Here a minimal snippet.

    	if (QFile file(path);
    		file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text))
    	{
    		QTextStream stream(&file);
    		QString content = stream.readAll(); // Gets stuck on 180mb file
    		//QString content = file.readAll(); // Workaround
    		file.close();
    	}
    
    sierdzioS 1 Reply Last reply
    0
    • MegamouseM Megamouse

      Hi,

      Does anyone else have issues with QTextStream::readAll in Qt 6.5.2 (on MSCV) ?
      It seems to be stuck when I try to read a 180mb file, which doesn't happen in Qt 5.15.2.
      It also seems to be significantly slower in general than in Qt 5.
      A 20mb file which is read almost instantly in Qt5 takes 4-5 seconds in the Qt 6 build.

      It seems like these two issues may be intertwined.
      Maybe the read time is simply increased exponentially with the file size.

      This somehow reminds me of the hilarous GTA5 online bug from a while back that unnecessarily caused ridiculous loading times for years.

      Here a minimal snippet.

      	if (QFile file(path);
      		file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text))
      	{
      		QTextStream stream(&file);
      		QString content = stream.readAll(); // Gets stuck on 180mb file
      		//QString content = file.readAll(); // Workaround
      		file.close();
      	}
      
      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @Megamouse for such big files I recommend using the stream part of QTextStream and read file in chunks :D It really gives amazing performance improvement, regardless of which Qt version you are using. It will lower both CPU and RAM usage by a lot. Talking from experience here :-)

      Regarding the slowness issue: this sounds like something Qt devs should look into. Please consider reporting it on Qt bugtracker!

      (Z(:^

      1 Reply Last reply
      3

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved