3 Replies Latest reply on Nov 5, 2010 5:56 PM by Flex harUI

    data binding performance question

    run,ryan! Level 3

      ----in model-------

      var target:Canvas = new Canvas();

      var targetWidth:int = target.x;

       

      //many changes on target and sync targetWidth

      ---end model----

       

      --- in view ----

      a.

      <...  width="{target.width}" ...

      b.

      <... width="{targetWidth}" ...

      ---end view ----

       

      my question is does a and b have any difference in performance?

        • 1. Re: data binding performance question
          run,ryan! Level 3

          and more on this question

          bind, eventListener, and changeWacher who has better performance

           

          that means, please sort bind(object), bind(object.attribute), eventListener and changeWacher(object.attribute)

          • 2. Re: data binding performance question
            drkstr_1 Level 4

            You're talking about micro seconds here...

             

             

            If it's really that critical to you, I would set up a stress test and find out yourself. Maybe someone has done this already and can share their results with you.

            • 3. Re: data binding performance question
              Flex harUI Adobe Employee

              If targetWidth was not needed for any other purpose, adding it will be

              "expensive".  It will have to be maintained to match target.x through some

              sort of code.

               

              But if it already exists and you ignore the cost of this intermediate

              variable, once targetWidth fires its binding change event or target fires

              its binding change event, the update time will be the same.  However, there

              is additional startup time and memory costs associated with a complex

              binding expression since listeners are attached at all levels.

               

              Under the covers, {} binding, BindingUtils, ChangeWatchers all add event

              listeners.  The binding subsystem is careful to watch all levels of a

              complex expression and evaluates at instantiation time.  It will always be

              cheaper to add the exact listeners at the right time, but then you have to

              maintain that yourself.