Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Qt libs linking impact on speed of C++ code
Forum Updated to NodeBB v4.3 + New Features

Qt libs linking impact on speed of C++ code

Scheduled Pinned Locked Moved C++ Gurus
12 Posts 4 Posters 4.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.
  • K Offline
    K Offline
    koahnig
    wrote on last edited by
    #2

    The question is if you are not comparing apples and pears?
    Is your C++ compiled in release mode and optimized for speed?
    I have noted in some of my applications that debug mode required quite a bit of time to load everything, while the release mode compilation was much faster. However, this was on Windows.

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

    1 Reply Last reply
    0
    • H Offline
      H Offline
      herophuong
      wrote on last edited by
      #3

      bq. Is your C++ compiled in release mode and optimized for speed?

      Yes, I compile both version with -O3 flag (which is default for release mode of CMake).

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        ZapB
        wrote on last edited by
        #4

        This is where a profiling tool such as valgrind comes in very useful.

        Nokia Certified Qt Specialist
        Interested in hearing about Qt related work

        1 Reply Last reply
        0
        • W Offline
          W Offline
          Wilk
          wrote on last edited by
          #5

          Hello
          Try to use gprof to find out which function takes most time.
          Also you may try to minimize using of text output (I mean information about current progress) during processing and avoid using of Qt containers inside your algorithm (as I've seen you don't do it).

          1 Reply Last reply
          0
          • H Offline
            H Offline
            herophuong
            wrote on last edited by
            #6

            [quote author="ZapB" date="1335724253"]This is where a profiling tool such as valgrind comes in very useful.[/quote]
            I have only used valgrind to detect memory leak. Thus I thought that this is the only function of valgrind. Thanks for remind me.

            [quote author="Wilk" date="1335730218"]Hello
            Try to use gprof to find out which function takes most time.
            [/quote]
            Thanks for suggesting the tool. I will give it a try.

            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              ZapB
              wrote on last edited by
              #7

              Take a look at the cachegrind tool of valgrind and also kcachegrind to visualise the results.

              Nokia Certified Qt Specialist
              Interested in hearing about Qt related work

              1 Reply Last reply
              0
              • H Offline
                H Offline
                herophuong
                wrote on last edited by
                #8

                Really thanks for all of you, guys. After using valgrind to analyze the run, I've resolved almost all bottlenecks on the program. The speeds of CLI-only version and no-GUI mode of GUI version are the same now and both of them have been reduced to 50s. LOL.

                1 Reply Last reply
                0
                • Z Offline
                  Z Offline
                  ZapB
                  wrote on last edited by
                  #9

                  Great news! Congratulations.

                  Nokia Certified Qt Specialist
                  Interested in hearing about Qt related work

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    herophuong
                    wrote on last edited by
                    #10

                    Though my question is still there because what I've done is only optimize CLI-only version and then merge the code with the GUI version (which means only the C++ code part is affected). Why are those speeds are not the same in the first place? May be I don't really need the answer for now but in the future projects, the problem may raise up in different situation.

                    1 Reply Last reply
                    0
                    • Z Offline
                      Z Offline
                      ZapB
                      wrote on last edited by
                      #11

                      Does your GUI do any additional work such as displaying progress info? I've not had a chance to look at your actual code.

                      Nokia Certified Qt Specialist
                      Interested in hearing about Qt related work

                      1 Reply Last reply
                      0
                      • H Offline
                        H Offline
                        herophuong
                        wrote on last edited by
                        #12

                        You can see the code of main.cpp in gui branch. (The link is at the first post). If the --no-gui option is passed, the code path is redirected to not run the GUI loop and the program will run as the CLI version do. What I've asked is about the no-GUI mode of GUI version, not its GUI mode.
                        The GUI mode actually runs slower because of GUI stuff but I think I can not do anything about that. GUI needs to display progress so we don't feel it is frozen while it's indexing files.

                        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