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

Support bindable JavaScript objects




      Once property var syntax has been added to QtQuick 2, clients will want to be able to bind to properties of JavaScript objects stored in such var properties. This task is to implement a constructor function on the global Qt object which takes an optional "original object" and produces a JavaScript object whose properties can be bound to.

      Previous Work:

      • Implementation complete
      • Unit tests complete
      • Documentation complete

      Outstanding Work:

      • Performance improvements
      • Code review


      Current Status (05/10/2011):

      Currently investigating performance trade-offs of various implementation details.

      Possible solutions include:

      • using Setter + Getter interceptors, storing property values in resource data, notifying manually
      • using Setter interceptor plus per-property Get Accessors, storing property values in resource data, notifying manually
      • using Setter fallback interceptor plus per-property Get and Set Accessors, storing property values in resource data, notifying manually
      • modifying V8 to provide update notification callbacks, and notifying manually (probably out of scope)

      Current research shows:

      • using per-property Get Accessors improves performance over the interceptor-only solution by an order of magnitude for Get operations, but decreases performance for construction and Set operations (due to cost of installing the accessors on the object). Overall, installing accessors is seen as a much better solution (combined single set+get cost is still lower in the installed-accessor case, and access is hugely more performant).
      • passing the propertyIndex as Accessor Data via external pointer allows us to implement deletion, but requires one heap allocation per "original object" property during construction, and one heap allocation during property Set.
      • passing the propertyIndex as Accessor Data as an unsigned integer allows a 1% performance increase during construction/set due to avoiding the allocation, but means that we cannot (easily) implement operator delete.

      Areas of further research:

      • see if a fallback setter interceptor plus Set Accessors can be implemented.


        Issue Links

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



              shausman Simon Hausmann
              chriadam Christopher Adams (closed Nokia identity) (Inactive)
              2 Vote for this issue
              7 Start watching this issue



                Gerrit Reviews

                  There are no open Gerrit changes