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. Application slow on the first run, then speed is ok
QtWS25 Last Chance

Application slow on the first run, then speed is ok

Scheduled Pinned Locked Moved General and Desktop
speed
6 Posts 3 Posters 2.1k 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.
  • R Offline
    R Offline
    reezeus
    wrote on 26 Mar 2015, 08:29 last edited by
    #1

    Hi there

    I have a GUI Qt application that works ok. When clicking on one button, I launch a very heavy function (in terms of consuming) as there are multiple sql query, excel opening/closing and file writing in each iteration of a single loop.
    When I start the app for the first time of the day and click the button, it takes about 20 mins to run. Then if I re-run it, it takes less than 2 mins (even if I re-run it 50 times). I mention that the function does exactly the same thing every time it is launched (there is nothing like "if this is has already been done today, then just update...")
    Could you please help me with this issue? Basically I will be very happy if I can run it in two mins when I launch it for the first time of the day.
    Thanks for taking the time to read.

    Reezeus

    K 1 Reply Last reply 26 Mar 2015, 08:57
    0
    • R reezeus
      26 Mar 2015, 08:29

      Hi there

      I have a GUI Qt application that works ok. When clicking on one button, I launch a very heavy function (in terms of consuming) as there are multiple sql query, excel opening/closing and file writing in each iteration of a single loop.
      When I start the app for the first time of the day and click the button, it takes about 20 mins to run. Then if I re-run it, it takes less than 2 mins (even if I re-run it 50 times). I mention that the function does exactly the same thing every time it is launched (there is nothing like "if this is has already been done today, then just update...")
      Could you please help me with this issue? Basically I will be very happy if I can run it in two mins when I launch it for the first time of the day.
      Thanks for taking the time to read.

      Reezeus

      K Offline
      K Offline
      koahnig
      wrote on 26 Mar 2015, 08:57 last edited by
      #2

      @reezeus
      Hi and welcome to devnet

      This sounds like a buffering issue, but is not related to Qt.

      When you say first time of the day, you mean after booting your system I guess. Another test you can do is shutting down your system and booting again. Probably it will take another 20 min and be faster afterwards.

      Waiting 20 minutes or even "only" 2 minutes is really long. You may want to think about ways to bridge those wating times. One possibility may be loading in a separate thread or possibly loading spread over different thread when on a multi core machine.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mcosta
        wrote on 26 Mar 2015, 09:04 last edited by mcosta
        #3

        hi,

        if your DB runs on the same machine probably it uses cache to optimize some queries; so could be the reason of this behaviour

        Once your problem is solved don't forget to:

        • Mark the thread as SOLVED using the Topic Tool menu
        • Vote up the answer(s) that helped you to solve the issue

        You can embed images using (http://imgur.com/) or (http://postimage.org/)

        1 Reply Last reply
        0
        • R Offline
          R Offline
          reezeus
          wrote on 26 Mar 2015, 09:42 last edited by
          #4

          Hi koahnig & mcosta,

          @koahnig-
          I have not tested to shut down and the run it again, I'll try it, but you are certainly right. 2 mins may sounds very long indeed, but there are billions of calculations, and basically I am happy to be able to run it in 2 mins (The first time I wrote the code for this purpose, it was in VBA and used to take 25/30 mins (everytime ;) ).

          @mcosta-
          Your idea seems very likely to be a good explanation, I have not think about it. Indeed the DB is a local one.
          Is there a way to load the cache before? (maybe opening and closing an ODBC connection prior to run my function?)

          Thanks for your help

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mcosta
            wrote on 26 Mar 2015, 09:52 last edited by
            #5

            @reezeus said:

            Is there a way to load the cache before?

            I don't know. But you should refer to the DB documentation

            Once your problem is solved don't forget to:

            • Mark the thread as SOLVED using the Topic Tool menu
            • Vote up the answer(s) that helped you to solve the issue

            You can embed images using (http://imgur.com/) or (http://postimage.org/)

            1 Reply Last reply
            0
            • R Offline
              R Offline
              reezeus
              wrote on 26 Mar 2015, 15:14 last edited by
              #6

              Ok thanks, I'll look at it.
              Cheers

              1 Reply Last reply
              0

              1/6

              26 Mar 2015, 08:29

              • Login

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