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.
- 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.