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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.0.0 Beta 1, 5.0.0
    • 4.7.3
    • SQL Support
    • None

      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).

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes