Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-138435

QTextStream::pos() seems to be linear over QFile size (or QFile::pos())

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.11
    • None
    • a64a536e6 (tqtc/lts-6.8), edc1df7d4 (tqtc/lts-6.5), 228187f9e (6.10), 4a2819453 (6.9), e58d3f3b6 (tqtc/lts-6.8), 55d270249 (tqtc/lts-6.5), 84bb60873 (dev), 73fa7ebb7 (6.10), 0d4a421f8 (6.9), 49e3833b4 (tqtc/lts-6.8), 154d7dc27 (tqtc/lts-6.5)

      The tst_QTextStream::pos3LargeFile() test shows quadratic behaviour in the size of the test file:

      File Size [KiB] Run Time [ms]
      1 34
      2 108
      4 783
      8 2243
      16 13742
      32 91884
      50 293146

      If I comment out the pos() calls, it takes 18ms for 50KiB.

      Even if the stream has to back off, this shouldn't take time linear in the file size or the position in the file. It should be possible to implement this in amortized constant time, which would make tst_QTextStream::pos3LargeFile() linear in the size of the test file.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.