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

[Performance] QSqlQuery::boundValues has unneeded O(n^2) complexity, can be O(n)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 4.7.3
    • Fix Version/s: 5.0.0 Beta 1, 5.0.0
    • Component/s: SQL Support
    • Labels:
      None

      Description

      For each bound value a call is made to QSqlResult::private->indexes.index(QHash.index, which is O(n)), which results in overall complexity of O(n^2).

      For ORMs that select records by a list of primary or foreign keys this can end up taking much longer than needed.

      Attached patch makes the call O(n).

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              zhongle honglei zhang
              Reporter:
              newellm Matthew Newell
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes