Page 1 of 2 12 LastLast
Results 1 to 20 of 27

Thread: How to make efficient apps?

  1. #1
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default How to make efficient apps?

    Hello!

    I'm writing apps for embedded using QT 4.5.1 and I was wondering are there any rules or something of making apps? I'm asking because my apps are taking a lot of system resources. For example one app take almost the same amount of resources as all Qtopia. How should I compile them? Now I'm compiling as 'Release' but it's not much better then 'Debug'. Any suggestions?

    thanks in advance
    best regards
    Tomasz

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to make efficient apps?

    There is no simple answer to this question. It all depends on what your application does and how it works. As a first step you might strip some functionality from Qt/Qtopia. A second step would be to better manage your app's resources by allocating less memory and freeing up memory as soon as you don't need it anymore. You can also tweak optimization settings of your compiler (i.e. optimize for size instead of speed).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to make efficient apps?

    What about using older version of QT? Would apps be faster and take less resources? Or maybe version is irrelevant?

    thanks in advance
    best regards
    Tomasz

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to make efficient apps?

    It depends how much older. In general Qt tends to be getting faster and more optimized. In general it's best to strip out features you don't need - performance will improve then too. But if you are thinking about getting a single download that will make your app twice as fast - it's not that simple. If you want improvements, you have to dedicate your own time to make (1) improvements to your code and only then (2) optimized builds of Qt.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to make efficient apps?

    Quote Originally Posted by Tomasz View Post
    What about using older version of QT? Would apps be faster and take less resources? Or maybe version is irrelevant?
    If you stick to the 4.x series, you should never downgrade for performance. The Trolls spend lots of time improving performance and actually have regressions for performance, to ensure that they do not reduce performance in any area of the library while working on new features. I'd rather recommend an upgrade if you're after performance.

    Then comes the question - what type of performance are you looking for? Graphics? SQL? Networking? Handling of QByteArrays?

  6. #6
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to make efficient apps?

    Quote Originally Posted by e8johan View Post
    Then comes the question - what type of performance are you looking for? Graphics? SQL? Networking? Handling of QByteArrays?
    Graphics and SQL are important for me. I won't downgrade version of my QT I think You're right. For now I've compiled my libs again disablig some options and setting optimization (-O1). Options I've used:

    Qt Code:
    1. -embedded arm -xplatform qws/linux-arm-g++ -prefix -qt-mouse-tslib -little-endian -no-dbus -no-phonon -no-phonon-backend -no-mmx -no-3dnow -no-sse -no-sse2 -no-webkit -no-qt3support -no-cups -no-largefile -optimized-qmake -no-openssl -nomake tools -nomake examples -nomake demos -release
    To copy to clipboard, switch view to plain text mode 

    Is there anything more I can do about optimization? I've found some options but I don't know what are that options for: stl, nis, sm, xshape, xinerama, xfixes, xrandr, xrender, tablet, xkb, separate-debug-info.
    And one more thing - in every tutorial about compiling QT libs optimization is set to -O0, is it safe to set it to -O2?

    thanks in advance
    best regards
    Tomasz

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to make efficient apps?

    That's not enough. Build a program called qconfig (it's in tools directory of the Qt source distribution) and run it. It will let you tweak some defines that will prevent building some parts of the libraries (i.e. drag&drop support, particular widgets you don't use, etc.).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. The following user says thank you to wysota for this useful post:

    Tomasz (19th September 2010)

  9. #8
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to make efficient apps?

    Thanks Wysota! Two more questions about that application - I've opened text file 'qfeatures.txt', disabled some features I won't use, and what now? When I want to save that file program asks me to choose header file. Should it be 'qglobal.h'? Should I change features in this app after or before making './configure [...]'?

    thanks in advance
    best regards
    Tomasz

  10. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to make efficient apps?

    Save it as src/corelib/global/qfeatures.h, run configure, make, etc.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. The following user says thank you to wysota for this useful post:

    Tomasz (19th September 2010)

  12. #10
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to make efficient apps?

    I've tried to change something with that app, but I get always the same error during compilation:

    Qt Code:
    1. ../../corelib/codecs/qtextcodec.cpp
    2. ../../corelib/codecs/qtextcodec.cpp:98: error: expected initializer before ‘*’ token
    3. ../../corelib/codecs/qtextcodec.cpp: In function ‘QTextCodec* createForName(const QByteArray&)’:
    4. ../../corelib/codecs/qtextcodec.cpp:137: error: ‘QFactoryLoader’ was not declared in this scope
    5. ../../corelib/codecs/qtextcodec.cpp:137: error: ‘l’ was not declared in this scope
    6. ../../corelib/codecs/qtextcodec.cpp:137: error: ‘loader’ was not declared in this scope
    7. ../../corelib/codecs/qtextcodec.cpp:142: error: ‘QTextCodecFactoryInterface’ was not declared in this scope
    8. ../../corelib/codecs/qtextcodec.cpp:142: error: ‘factory’ was not declared in this scope
    9. ../../corelib/codecs/qtextcodec.cpp:143: error: ‘qobject_cast’ was not declared in this scope
    10. ../../corelib/codecs/qtextcodec.cpp:143: error: expected primary-expression before ‘>’ token
    11. ../../corelib/codecs/qtextcodec.cpp: In function ‘QTextCodec* createForMib(int)’:
    12. ../../corelib/codecs/qtextcodec.cpp:158: error: ‘QTextCodecFactoryInterface’ was not declared in this scope
    13. ../../corelib/codecs/qtextcodec.cpp:158: error: ‘factory’ was not declared in this scope
    14. ../../corelib/codecs/qtextcodec.cpp:159: error: ‘qobject_cast’ was not declared in this scope
    15. ../../corelib/codecs/qtextcodec.cpp:159: error: expected primary-expression before ‘>’ token
    16. ../../corelib/codecs/qtextcodec.cpp:159: error: ‘loader’ was not declared in this scope
    17. ../../corelib/codecs/qtextcodec.cpp: In static member function ‘static QList<QByteArray> QTextCodec::availableCodecs()’:
    18. ../../corelib/codecs/qtextcodec.cpp:1000: error: ‘QFactoryLoader’ was not declared in this scope
    19. ../../corelib/codecs/qtextcodec.cpp:1000: error: ‘l’ was not declared in this scope
    20. ../../corelib/codecs/qtextcodec.cpp:1000: error: ‘loader’ was not declared in this scope
    21. ../../corelib/codecs/qtextcodec.cpp: In static member function ‘static QList<int> QTextCodec::availableMibs()’:
    22. ../../corelib/codecs/qtextcodec.cpp:1028: error: ‘QFactoryLoader’ was not declared in this scope
    23. ../../corelib/codecs/qtextcodec.cpp:1028: error: ‘l’ was not declared in this scope
    24. ../../corelib/codecs/qtextcodec.cpp:1028: error: ‘loader’ was not declared in this scope
    To copy to clipboard, switch view to plain text mode 

    even if I change only one thing. Maybe I'm doing something wrong?

    thanks in advance
    best regards
    Tomasz

  13. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to make efficient apps?

    What exactly did you change? Could you compress and post your header file created by qconfig?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  14. #12
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to make efficient apps?

    I've changed only drag&drop option. Header file created by qconfig looks like this:

    Qt Code:
    1. /* Kernel */
    2. #ifndef QT_NO_DRAGANDDROP
    3. # define QT_NO_DRAGANDDROP
    4. #endif
    To copy to clipboard, switch view to plain text mode 

    And nothing more.

    thanks in advance
    best regards
    Tomasz

  15. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to make efficient apps?

    And what exactly did you do afterwards? Did you clean the source tree prior to running configure and make?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  16. #14
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to make efficient apps?

    Quote Originally Posted by wysota View Post
    And what exactly did you do afterwards? Did you clean the source tree prior to running configure and make?
    Afterwards I've run 'configure' and then 'make'. What about 'clean source tree prior'? Why and how should I do it?

    thanks in advance
    best regards
    Tomasz

  17. #15
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to make efficient apps?

    Quote Originally Posted by Tomasz View Post
    Why and how should I do it?
    "make distclean". You should run it to be sure there are no stale files remaining from the previous compilation.

    By the way, which version of Qt are you trying to build?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  18. The following user says thank you to wysota for this useful post:

    Tomasz (20th September 2010)

  19. #16
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to make efficient apps?

    Quote Originally Posted by wysota View Post
    "make distclean". You should run it to be sure there are no stale files remaining from the previous compilation.
    By the way, which version of Qt are you trying to build?
    4.5.1 - I've built it earlier but in 'simple' version (without qconfig configuration) and it works, but I want to make it as fast as I can by disabling all unecessary things.
    I'll try what You said. Thanks for help!

    best regards
    Tomasz

  20. #17
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to make efficient apps?

    Why not build 4.6.3? 4.6 branch has introduced many optimizations to some areas of Qt.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  21. #18
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to make efficient apps?

    Earlier I had some problems with building 4.6.x version. But now I think I can handle that problems and try to build it - You've convinced me!

    best regards
    Tomasz

  22. #19
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to make efficient apps?

    Quote Originally Posted by wysota View Post
    "make distclean". You should run it to be sure there are no stale files remaining from the previous compilation.
    I've done it and have the same problem. Nothing changed.

    thanks in advance
    best regards
    Tomasz

  23. #20
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to make efficient apps?

    What is the offending line? What platform are you building for?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. efficient way to store menu items in file
    By h123 in forum Qt Programming
    Replies: 5
    Last Post: 24th July 2009, 07:52
  2. Replies: 0
    Last Post: 26th June 2009, 18:53
  3. Efficient way of inserting rows?
    By afflictedd2 in forum Qt Programming
    Replies: 1
    Last Post: 14th July 2008, 21:01
  4. Efficient Scaling and Rotating of QGraphicsView
    By forrestfsu in forum Qt Programming
    Replies: 10
    Last Post: 12th December 2006, 17:28
  5. Is QMap efficient in case of frequent read access ?
    By yellowmat in forum Qt Programming
    Replies: 4
    Last Post: 19th November 2006, 09:20

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.