Flex Builder performance tweak

June 18, 2008


 
I’ve been struggling with Flex Builder these past few days. There’s something wrong with this one particular project which takes way too long to compile while all the other projects seem to be ok. I haven’t been able to figure out what’s wrong with this one project and frankly I haven’t spent much time on it either. I wonder if there is a debug switch that I could turn on and look at a log that would tell me more about what’s happening. If you know about such a switch or any other way that would help me figure out what’s going on, I’d appreciate the help.

Meanwhile, I was reminded of a performance tweak many people used when working with Flex Builder 2 but I somehow never had to resort to it since Flex Builder 3 came out…. Flex Builder is essentially Eclipse, and Eclipse allows you to control the heap size available for it when it runs in the JVM. This is especially helpful if you are seeing Flex Builder crash or hang indefinitely.

  1. Go to the Flex Builder Install directory
  2. Look for the file named FlexBuilder.ini (eclipse.ini if you are using the plugin version) on a Mac you will have to “Show Packages Contents” on the FlexBuilder.app file to find it.
  3. My FlexBuilder.ini file looked something like this:
    -vmargs
    -Xdock:icon=../Resources/flexbuilder.icns
    -Xdock:name=Flex Builder
    -XstartOnFirstThread
    -Xms128m
    -Xmx512m
    -XX:MaxPermSize=256m
    -XX:PermSize=64m
    -Dorg.eclipse.swt.internal.carbon.smallFonts
    -Dorg.eclipse.swt.internal.carbon.noFocusRing
  4. This file is used to provide arguments to the java virtual machine and the arguments -Xms and -Xmx define the range (in mega bytes) of the heap size available to FlexBuilder at runtime.
  5. Tweak the -Xms and -Xmx values for optimal performance

Changing -Xms to 256m and -Xmx to 1536m on my 2GB RAM system did make things significantly faster. Although, I still have to figure out what is causing this one particular project to take comparatively longer time to compile.

11 Responses - What do you think?

  1. Very helpful, thanks

  2. Are you using a lot of SWCs in this project?

  3. Hi Dan,

    The project uses 2 SWCs .. I have used the same 2 SWCs in other projects too and they work fine, so I don’t think they are the cause of the slowdown .. although now that you mentioned it I wonder what compiles faster .. an included swc or an external source path?

  4. I know that if you are using really large ( or many ) SWCs you need to bump up this number because when the compiler links your source to the SWC, I assume it loads the entire thing into memory to do it.

    In terms of speed I would also have to assume linking to the source is faster, it doesn’t have to navigate the SWC to find where to link to, just resolve it to another file.

  5. Dan,

    Your comment above made sense so I replaced both the SWCs (degrafa and pv3d) with external source paths, but still not much improvement .. the project takes over a minute to compile.

    My earlier suspicion was embedded assets like fonts etc .. but getting rid of all of them did not help either.

  6. [...] found this post which seemed to provide the solution: increase the size of the heap space through the Flex [...]

  7. Flex Builder is essentially Eclipse this statement is not technically right , Flex Builder comes in two variants as an Eclipse Plugin and Rcp .You cannot call it as an eclipse

    Thanks and Regards
    Flexer

  8. Well you can make that statement, the standalone flex builder is a basic eclipse with the flex plugin installed. You can take the standalone version and add any other eclipse plugins, effectively turning it into a normal eclipse installation.

  9. on my pc when i do liek this it Failed to initialize(start) Flex Builder ..it only takes Xmxupto 512m …not more than this value
    Don’t know if it really works on other PCs or not but on mine it really does’nt work dude.

  10. Amar,

    Xmx specifies the max value of memory that FlexBuilder is aloud to use, provided you have that much physical memory .. how much RAM do you have on your system? … if its less than the Xmx value then FlexBuilder would fail to initialize.

    Mrinal

  11. KAUSHIK BASU
    January 28th, 2010

    Thanks Mrinal for sharing this. The tweak was very helpful for me to reduce the time to compile my code.

Your thoughts or questions: