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. Comparison of Qt's foreach and range-based for in C++11

Comparison of Qt's foreach and range-based for in C++11

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.3k 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.
  • C Offline
    C Offline
    ckakman
    wrote on 27 Sept 2014, 12:19 last edited by
    #1

    Hi,

    I have made some benchmarking to compare foreach and range-for performance on QVector and QHash. I think some of you may find the results interesting.

    The benchmark code and the results are "here":https://bugreports.qt-project.org/browse/QTBUG-41636

    Edit: I have fixed the benchmark so that copying the container takes place inside the benchmark loop. Benchmark code and results are updated in the report.

    1 Reply Last reply
    0
    • I Offline
      I Offline
      Ildar
      wrote on 28 Sept 2014, 06:53 last edited by
      #2

      Thank you for this test!
      I have some questions:

      1. Are you compiling in release mode?
      2. What level of optimization - O1, O2, O3?
      1 Reply Last reply
      0
      • C Offline
        C Offline
        ckakman
        wrote on 28 Sept 2014, 11:48 last edited by
        #3

        [quote author="Ildar" date="1411887195"]Thank you for this test!
        I have some questions:

        1. Are you compiling in release mode?
        2. What level of optimization - O1, O2, O3?[/quote]

        Yes, I've run the tests in release mode. Optimization level is -O2 for both cland and gcc. I am using qmake to build the projects, so these are the defaults.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jeremy_k
          wrote on 28 Sept 2014, 20:55 last edited by
          #4

          This looks like good content for the wiki, at least in the short term.

          http://qt-project.org/wiki/Category:Developing_with_Qt::Performance_Tips

          Asking a question about code? http://eel.is/iso-c++/testcase/

          1 Reply Last reply
          0

          1/4

          27 Sept 2014, 12:19

          • Login

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