Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. App slow startup

App slow startup

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 1.4k 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.
  • T Offline
    T Offline
    Trian
    wrote on last edited by
    #1

    Hi. My app has slow starup, about 45 seconds. I notice importing one of 284.5 kB Javascript file takes 30 seconds. I wonder why it takes a long time to import this Javascript into an QML? I also notice that my other 62.7 kB Javascript, takes under a second to import. Comparing these Javascript files, the fast JavaScript file has .pragma library and .import; whereas, the slow one does not have those. Could you suggest some ideas on how to further investigate or to resolve the issue?
    Thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      What do you have in that big file ? Do you need everything from it ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • T Offline
        T Offline
        Trian
        wrote on last edited by Trian
        #3

        Thank you, SGaist. In the big file, there are just a handful of functions. There is a giant function containing 5,000 line of codes ( don't ask me why since I have just given this project), and for startup, this is a real bottleneck function. This function is being called once upon startup. To verify, I comment out the caller, so that this method won't get invoked, and there is no improvement in startup time. Now if I literally remove the body of this giant method and return null, startup time is reduced to just 18 seconds. I want to refactor this function and move it to c++ side; unfortunately, this function is quite complicate. Thus, refactor would be time consuming. So now. I am looking for suggestions.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Schluchti
          wrote on last edited by
          #4

          Do you need that function really at start up? I am not sure if that works, but you could try to put the import statement in a own QML component that gets loaded asynchronously in a Loader.

          Want to read more about Qt?

          https://gympulsr.com/blog/qt/

          Latest Article: https://gympulsr.com/blog/qt/2017/06/14/ios-background-music-qt.html

          1 Reply Last reply
          2

          • Login

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