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. [solved] Qt qmake compiled program is 4 times slower than compiled with cmake!?
Forum Updated to NodeBB v4.3 + New Features

[solved] Qt qmake compiled program is 4 times slower than compiled with cmake!?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.8k 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.
  • V Offline
    V Offline
    visoda
    wrote on 28 Nov 2013, 11:24 last edited by
    #1

    Hi,

    may you can help me, cause I'm quite new to linux, qmake and cmake and therefore absolutely do not know why I get the following results.

    I intend to use a c++ library in my Qt project. You will find this library "here":http://www.cvlibs.net/download.php?file=libviso2.zip, including a readme.txt.

    This is the CMakeLists.txt from the downloaded library:
    @

    project

    cmake_minimum_required (VERSION 2.6)
    project (libviso2)

    directories

    set (LIBVISO2_SRC_DIR src)

    include directory

    include_directories("${LIBVISO2_SRC_DIR}")

    use sse3 instruction set

    SET(CMAKE_CXX_FLAGS "-msse3")

    sources

    FILE(GLOB LIBVISO2_SRC_FILES "src/*.cpp")

    make release version

    set(CMAKE_BUILD_TYPE Release)

    demo program

    add_executable(viso2 ${LIBVISO2_SRC_FILES})
    target_link_libraries (viso2 png)
    @

    First I created a new Qt project, inserted the the c++ files and adapted the .pro file slightly.

    the .pro file:
    @
    #-------------------------------------------------

    Project created by QtCreator 2013-11-27T22:47:00

    #-------------------------------------------------

    QT += core

    QT -= gui

    TARGET = VisoOdo
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app

    SOURCES += main.cpp
    viso.cpp
    viso_stereo.cpp
    viso_mono.cpp
    triangle.cpp
    reconstruction.cpp
    matrix.cpp
    matcher.cpp
    filter.cpp

    HEADERS +=
    viso.h
    viso_stereo.h
    viso_mono.h
    triangle.h
    timer.h
    reconstruction.h
    matrix.h
    matcher.h
    filter.h

    OTHER_FILES +=
    VisoOdo.pro.user

    added

    QMAKE_CXXFLAGS += -msse3

    https://wiki.gentoo.org/wiki/GCC_optimization

    #QMAKE_CXXFLAGS += -march=native

    added

    unix:!macx: LIBS += -lpng
    #unix:!macx: LIBS += -lpng12
    @

    When I compile this program with Qt and execute it the program takes ~1620ms.

    But when I build this library with cmake [1] and execute it, the same program takes only ~420ms!

    My problem is I have to use Qt, but it's far to slow.
    Is there a way to get with Qt the same performance as with Cmake?

    May has it something to do with the msse3? I also tried “QMAKE_CXXFLAGS += -march=native”, but the result is the same.

    Please tell me if I should send you the Qt and Cmake project files.

    Thanks a lot for your help!


    My system:

    Dell Workstation M6700
    Intel(R) Core(TM) i7-3740QM CPU @ 2.70GHz
    Linux Ubuntu 12.04 LTS
    64 bit
    QtCreator 2.8.1, Based on Qt 5.1.1 (GCC 4.6.1, 64 bit)

    [1]
    I do not use any additional flags at compiling with cmake:
    2) Type 'cmake .'
    3) Type 'make'
    4) Run './viso2 2010_03_09_drive_0019'

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bobEdwards
      wrote on 28 Nov 2013, 14:49 last edited by
      #2

      Hello,

      Perhaps try adding:

      CONFIG += release

      to your qmake .pro file

      1 Reply Last reply
      0
      • V Offline
        V Offline
        visoda
        wrote on 28 Nov 2013, 20:08 last edited by
        #3

        Hello,

        thats it! The qmake builded program takes now 430ms --> equal to cmake.

        Many thanks for your help!!!!

        1 Reply Last reply
        0

        1/3

        28 Nov 2013, 11:24

        • Login

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