现在的位置: 首页 > 综合 > 正文

FlexBuilder优化技巧

2013年11月11日 ⁄ 综合 ⁄ 共 3667字 ⁄ 字号 评论关闭
文章目录
经常听到很多FlexDeveloper抱怨自己的电脑配置已经很高了,但是FlexBuilder Build projct的时候仍然很慢.
应该怎么办呢?
其实很简单,只要做到以下两点就可以提高编译速度,效果非常明显:
1. 不要使用Automatically Build, 使用Ctrl+B快捷键手动编译.
Build  Automatically :如果选择,每有一次修改,只要保存就会执行。
Build  All: 所有修改完毕,最后bulid 一次。
Build Project: 
Build work set:
以"Build Automatically", "Build All" 和 "Build Project" 都是只编译更改的部分,只有"Clean"才是重新编译全部Resource.
如果你当前只有一个Project的话, "Build All" == "Build Project".
究竟是使用"Build Automatically ", 还是"Build All"应该是根据具体情况和个人习惯来选择的.比如说我修改一个功能需要改动五个文件,每个改完都需要Save,但是只有五个都改完才需要Build.这时候使用"Build Automatically"显然是不适当的,因为多编译了四次.

2. 关闭所有当前不用的Project, 最好只剩一个.

===========================================================================

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.

抱歉!评论已关闭.