Performance Tips Needed

David Coletta is putting out a call for Flex performance tips for his MAX talk. Please take a moment and think about any ideas you might have and send them his way!

I’ve gathered up some hints from some of the folks who’ve been thinking about compiler performance recently. Most are related to your system setup at this point, and admittedly they may be big requirements. We’re trying to make major improvements as I write this 🙂 But in the meantime, these may help you…

System and Java related

  • Turn off virus scanning software
  • Don’t compress or encrypt your filesystem (major cause of fragmentation and slowdown)
  • Windows users — defragment regularly!
  • For plug-in users: Make sure you are running Eclipse under the 1.5 JRE:
    • On Windows, add -vm “C:\Program Files\Java\jre1.5.0_12\bin\javaw.exe” to your Eclipse shortcut
    • Command-line users: Make sure your JAVA_HOME is pointing to a 1.5 JRE, as well
  • Java is very sensitive to disk swapping/paging; make sure you’ve got 2Gb of RAM to start with, and:
    • Give Eclipse more memory so it doesn’t need to garbage collect as often: (on Windows, e.g.) -vmargs -Xms512m -Xmx768m (the bigger -Xmx is, the better)
    • Give FCSH more memory by editing the jvm.config file in the SDK’s bin directory
  • Untested: If you have a 64bit computer, you may be able to give the 64bit JRE more than 2gb of memory (if you have it) — Flex does NOT need this much memory, but the more Java has, the less it will garbage collect…
  • Some users report that removing the -XX:MinHeapFreeRatio=20 setting for Flex Builder/Eclipse improves performance.
    • On Windows, just remove this argument in the Flex Builder shortcut that you use.

Flex Builder-related

  • If you do not need to run your applications in a web browser for development, you can improve your app’s startup time and memory usage (from when you press the Play button in FlexBuilder) by turning off Generate HTML template in Project | Properties | Flex Compiler — this will start your application in the standalone Flash Player (this should be sufficient for most applications that don’t rely on running in a browser, or customized templates).
  • Disable Copy non-embedded assets in Project | Properties | Flex Compiler — you will need to remember to copy/update these assets manually into the bin folder (if you have any).
  • For each non-library project, make sure you are building as few Application and Module MXMLs as you need. It’s common for the list to increase over time (and accidentally) when you run temporary or unused applications (they get automatically added to the build list). Manager this list in Project | Properties | Flex Applications.
  • Close projects that you do not need open — they consume memory!
  • If your application is composed of more than (roughly) three Flex Builder projects (e.g. a Flex Project and two Library Projects), you may find that refactoring your code into fewer projects will speed-up compile time, and reduce overall memory usage. You should, of course, keep your source code seperated into logical units, so this is for people that want to try a more extreme measure at the cost of elegance (and note that this hint goes against practices we recommended in the past, so we’re looking to improve things here).
    • Another method that may work for you (and allow you to maintain your original code seperation and projects) is to take advantage of external source folders. In a new workspace, create a new project which will combine existing source from multiple locations, and use Project | Properties | Flex Build Path | Add Folder. For day-to-day development, you can use this project, and still keep the seperated projects.

7 Responses to Performance Tips Needed

  1. Marek says:

    this maybe what we looking for.

  2. Cory says:

    A couple things that I do when working with Flex and Java…Flex Builder (compiling Java backend and Flex).-Run two instances of eclipse. One for Flex, one for Java. This reduces the size of the java process running and speeds up compiles. It seems to consume alot of memory when using both the flex and the java perspectives in same instance of eclipse. It will also reduce startup time.-Create separate workspaces for Flex and Java. This will reduce startup time. Only one perspective will be loaded at startup.-Use Ant to compile java code in a cmd prompt. It is faster than building within eclipse.-Use a cmd window to run tomcat rather than the tomcat plugin for eclipse. Set the logs up so that they write to std out. This way you can watch the logs while your web app runs.

  3. 租車 says:

    A couple things that I do when working with Flex and Java…

  4. Muzak says:

    Get this Eclipse plugin to free up memory (GC):

  5. ef says:

    Everything you need to help you find, apply, and get into the right school. School search, admissions tips, test preparation, financial aid, scholarships, school rankings, and more.

  6. 国内机票 says:

    It’s common for the list to increase over time when you run temporary or unused applications