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. QSortFilterProxyModel vs SQLite (with FTS3)? in term of performance and memory usage
Forum Updated to NodeBB v4.3 + New Features

QSortFilterProxyModel vs SQLite (with FTS3)? in term of performance and memory usage

Scheduled Pinned Locked Moved Unsolved General and Desktop
18 Posts 4 Posters 1.5k Views 1 Watching
  • 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.
  • Christian EhrlicherC Offline
    Christian EhrlicherC Offline
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #9

    @mbruel said in QSortFilterProxyModel vs SQLite (with FTS3)? in term of performance and memory usage:

    haha thanks. I would have imagined that Qt could provide such things to kind of "benchmark" their Proxy mechanism... or that some people would have done it to see how it reacts under heavy load.

    It all depends on the data - every benchmark will be wrong for any other usecase.

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    1 Reply Last reply
    1
    • mbruelM Offline
      mbruelM Offline
      mbruel
      wrote on last edited by
      #10

      @Christian-Ehrlicher said in QSortFilterProxyModel vs SQLite (with FTS3)? in term of performance and memory usage:

      It all depends on the data - every benchmark will be wrong for any other usecase.

      yes that's true, but it could give a general idea and maybe warn about bottlenecks... like 5% match (text search) on X records (10k, 100k, 1M) of text length 1000 chars for example.

      Well, as I'm learning QML, I've chosen the Proxy way using a self populated tree Model.
      It's working great, even on an old iPhone SE :)

      I lost most of the time to tweak the deprecated TreeView from Controls 1.4... what a shame it is not in the v2 oO I hope it will be back with Qt6... It is definitely needed even if it is an hassle to understand how to render it (especially due to the necessary TableViewColumn....)

      For those interested, I filter up and down the tree ProxyModel for each row in order to make the filtering decision. It works smoothly with 40k records.
      Here is the filtering method.

      @JonB and here is the way I populate the model from SQL. with the request being:

      const QString ClementineRemote::sLibrarySQL =
              "select artist, album, title, track, filename from songs order by artist, album, track, title";
      
      Christian EhrlicherC 1 Reply Last reply
      0
      • fcarneyF Offline
        fcarneyF Offline
        fcarney
        wrote on last edited by
        #11

        Have you played with QSqlTableModel? It is based upon the abstract table model. I am going to be using this in a project and am curious if you compared its speed.

        C++ is a perfectly valid school of magic.

        mbruelM 1 Reply Last reply
        0
        • fcarneyF fcarney

          Have you played with QSqlTableModel? It is based upon the abstract table model. I am going to be using this in a project and am curious if you compared its speed.

          mbruelM Offline
          mbruelM Offline
          mbruel
          wrote on last edited by
          #12

          @fcarney no I've not tried QSqlTableModel. As explained I wanted a Tree not a table.
          alt text

          1 Reply Last reply
          0
          • mbruelM mbruel

            @Christian-Ehrlicher said in QSortFilterProxyModel vs SQLite (with FTS3)? in term of performance and memory usage:

            It all depends on the data - every benchmark will be wrong for any other usecase.

            yes that's true, but it could give a general idea and maybe warn about bottlenecks... like 5% match (text search) on X records (10k, 100k, 1M) of text length 1000 chars for example.

            Well, as I'm learning QML, I've chosen the Proxy way using a self populated tree Model.
            It's working great, even on an old iPhone SE :)

            I lost most of the time to tweak the deprecated TreeView from Controls 1.4... what a shame it is not in the v2 oO I hope it will be back with Qt6... It is definitely needed even if it is an hassle to understand how to render it (especially due to the necessary TableViewColumn....)

            For those interested, I filter up and down the tree ProxyModel for each row in order to make the filtering decision. It works smoothly with 40k records.
            Here is the filtering method.

            @JonB and here is the way I populate the model from SQL. with the request being:

            const QString ClementineRemote::sLibrarySQL =
                    "select artist, album, title, track, filename from songs order by artist, album, track, title";
            
            Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #13

            @mbruel said in QSortFilterProxyModel vs SQLite (with FTS3)? in term of performance and memory usage:

            ike 5% match (text search) on X records (10k, 100k, 1M) of text length 1000 chars for example.

            How should this be possible? It depends on your implementation and your data...

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            mbruelM 1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              @mbruel said in QSortFilterProxyModel vs SQLite (with FTS3)? in term of performance and memory usage:

              ike 5% match (text search) on X records (10k, 100k, 1M) of text length 1000 chars for example.

              How should this be possible? It depends on your implementation and your data...

              mbruelM Offline
              mbruelM Offline
              mbruel
              wrote on last edited by
              #14

              @Christian-Ehrlicher it should only depend on the data. the idea would be to produce a data set of N records with length around a determined number of chars l.
              Then you provide texts to search that would match an exact percentage p.
              you can do that using whatever DB. Normally if you export the data set in another one or in whatever program, the output should be the same. You can thus compare the execution time. Does it make sense?

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #15

                @mbruel said in QSortFilterProxyModel vs SQLite (with FTS3)? in term of performance and memory usage:

                Does it make sense?

                Not really - how to you compare texts is very important, also if you don't compare text but numbers and so on.
                You can write a testcase on your own to check it.

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                1 Reply Last reply
                0
                • mbruelM Offline
                  mbruelM Offline
                  mbruel
                  wrote on last edited by
                  #16

                  @Christian-Ehrlicher the idea would have been to test comparison implementation on text only, for example a LIKE "%<text>%"
                  but I see what you mean.
                  I guess this kind of testing is done by companies to decide which tool/implementation to use on products where performance is critical. Myself, I don't have this need...

                  JonBJ 1 Reply Last reply
                  0
                  • mbruelM mbruel

                    @Christian-Ehrlicher the idea would have been to test comparison implementation on text only, for example a LIKE "%<text>%"
                    but I see what you mean.
                    I guess this kind of testing is done by companies to decide which tool/implementation to use on products where performance is critical. Myself, I don't have this need...

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #17

                    @mbruel said in QSortFilterProxyModel vs SQLite (with FTS3)? in term of performance and memory usage:

                    LIKE "%<text>%"

                    Nothing to do with your proposed timing tests. Just want to make sure you are aware: there will (should) be an enormous time difference between LIKE "%<text>%" versus LIKE "<text>%".

                    1 Reply Last reply
                    0
                    • mbruelM Offline
                      mbruelM Offline
                      mbruel
                      wrote on last edited by mbruel
                      #18

                      @JonB

                      Nothing to do with your proposed timing tests

                      maybe I wasn't clear but that's what I'm asking since the beginning. my initial goal was to use a QSortFilterProxyModel and set its regexp (cf here), so I was planing to do a LIKE "%<text>%". In fact even worst for the perf as in Qt I can do it case insensitive.

                      My concern was to know how QSortFilterProxyModel handle a big/huge number of records. I'm testing with 40k, it is loading and filtering in few hundreds milliseconds. What about with 100k or 1M records?
                      That is why I was considering using SQL instead. Why not FTS even, as I said since the beginning, if it would limit the search to full word or like you told me a "search for left-hand side match".

                      So basically I was interested in any kind of benchmarks for searching either a regexp, a full word or a left-hand side match. Benchmark/Feedback on QSortFilterProxyModel and why not a comparison with SQLite or another DB.

                      Edit: as you could imagine from the picture above, my textfield trigger a search each time the text changes (for each char :))
                      Edit2: and yes I'm aware of the difference, I was just willing to accept limiting the search if it was lagging too much

                      1 Reply Last reply
                      0

                      • Login

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