Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-54029

Referencing property by object.object.name instead of name is 6 times slower

    XMLWordPrintable

Details

    Description

      When running the code from http://paste.ubuntu.com/17179779/ in qmlscene the code that uses object.object.name instead of the name of the property directly is six times slower.

      Feels like it should be as fast?

      Inline code:

      import QtQuick 2.4
      
      Item {
          id: root
          width: 400
          height: 400
          property alias moo: item
      
      
          Item {
              id: item
              readonly property bool result: true
      
              Component.onCompleted: {
                  var start, i;
                  var iters = 1000000;
      
                  start = new Date;
                  i = iters;
                  do {
                      if (root.moo.result) {
                      }
                  } while (--i);
                  console.log('root.moo.result', new Date - start, root.moo.result);
      
                  start = new Date;
                  i = iters;
                  do {
                      if (result) {
                      }
                  } while (--i);
                  console.log('result', new Date - start, result);
              }
          }
      }
      
      qml: root.moo.result 318 true
      qml: result 55 true
      
      Why is the second iteration six times slower?
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            shausman Simon Hausmann
            tsdgeos_canonical Albert Astals Cid (Canonical) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes