3 Replies Latest reply on Jul 1, 2008 1:14 AM by Karl_Sigiscar_1971

    Flex Components Cause High CPU Utilization

      Hi -

      I have a Flex 3 application that uses a number of the built-in Flex components - specifically the combobox/drop-down list component. When the application is being used in the browser, the CPU will spike at 100% when I simply click the down arrow to display the drop-down list. It is fairly repeatable in some environments (usually Windows). The CPU will be at 5% until you drop down the list of values and bam it jumps and stays at 100%.

      Once this occurs, the CPU will stay at 100% until I close the browser. Has anyone else seen this? Any thoughts on a) what I can do to fix the problem or b) ways in which to diagnose?

      Any help would be greatly appreciated!
        • 1. Re: Flex Components Cause High CPU Utilization
          Karl_Sigiscar_1971 Level 3

          There are many reasons why this could happen.

          Use the Profiler in Flex Builder 3 Professional to know what component / class causes the problem in your code.
          • 2. Re: Flex Components Cause High CPU Utilization
            3leggeddog Level 1
            Hi Karl -

            Thank you for your reply. Unfortunately, I don't see the issue when running in the IDE and via Profiler. The problem is not present for everyone, and we typically don't see it on our dev systems. Are there a few common reasons this can happen so we can investigate those first?
            • 3. Flex Components Cause High CPU Utilization
              Karl_Sigiscar_1971 Level 3
              Common reasons:

              - A method can be called too often.
              - A method can execute too much code (one that does not execute in the frame, but takes several frames to complete)
              - There are too many instances of a given class / component.
              - A timer fires off too often.
              - Some objects are not garbage collected.

              Common solutions:

              - Use deferred instantiation.
              - Use callLater().
              - Big methods with heavy processing should calculate the time they need to execute. If they need too much time, they should do some work then resume processing in the next frame.
              - Reduce the number of instances of a given class.
              - Use garbage collection best practices.

              That would be helpful to install Flex Builder 3 Professional on one of the machines where the problem occurs and run the Profiler.