2 Replies Latest reply on Dec 23, 2009 11:39 AM by msakrejda

    How expensive are non-display list bindings?

    msakrejda Level 4

      I'm building out some infrastructure around mx.binding.BindingUtils, and it occurs to me that I might have, liberally, up to a couple of hundred non-display list bindings at any given time. Each binding is likely never to be updated, but it's much cleaner for the model if I pretend that I don't know this up front. Most binding hosts will have just a single target site. Is just creating the bindings terribly expensive? I am disposing of bindings with ChangeWatcher.unwatch() after I am done with them.

        • 1. Re: How expensive are non-display list bindings?
          Flex harUI Adobe Employee

          Fundamentally, binding works by responding to an event when something changes.  I haven't done a scientific study, but I'm pretty sure that the minimal code:

           

          Someobj.addEventListener("someEvent", doBindingTask);

           

          is going to be more efficient than calling BindingUtils at startup, which is usually more efficient than defining a binding using {} in MXML.

           

          BindingUtils generates an anonymous function and also parses the chain, and often, you only want to listen to one point on the chain and not all points on the chain

           

          But I'd be surprised if 200 bindings with BindingUtils show up as anything significant in the profiler.

           

          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          • 2. Re: How expensive are non-display list bindings?
            msakrejda Level 4

            Thanks. That was my feeling but I wanted a sanity-check. Unfortunately, the infrastructure is generic enough that I'd probably need to do do the same things that BindingUtils does, or just make the model more complex (which I can fall back on, but I'd rather not optimize prematurely unless the idea seems inherently too expensive).