Priority
Major
Type
Performance Problem 
State
Fixed 
Assignee
Alexander Doroshko 
Subsystem
Flex Support 
Affected versions
Fixed in
Fixed in build
94.244  
  • Submitted by   Joa Ebert
    7 months ago (17 Dec 2009 14:09)
  • Updated by   Christian Tytgat
    4 months ago (03 Mar 2010 13:20)
IDEA-26866 Stop using FCSH
4
Please stop using the Flex Compiler Shell. Compilation speed could be increased a lot when using a different technique. Let me explain this in a little bit more detail. Say, we have modules A, B, C and D.

A depends on C
B depends on C
C depends on D

So this means we have a possible topsort of {D, C, B, A} but we can also have a two-dimensional sort like D}, {C}, {B, A. In that case we know which modules can be compiled in parallel. So we can compile D, then C, and then A and B in parallel. Basically the number of compiler processes should be limited of course since those "parallel projects" can grow large and you can have 50 of them.

Now that we can compile projects in parallel it would be an ideal option to stop using FCSH and spawn only a process of compc or mxmlc for each individual module. The cool thing is that FCSH is absolutely not needed when using the "-incremental" flag which will store a *.cache file for each compilation target next to the output file.

Why is this a better approach? If you have a really big project with 100+ modules the FCSH will run out of memory every time which makes compiling the project in our case a very long process. First FCSH will grow to some ridicolous amount of memory like 1GB and then crash, grow again to 1GB and crash ... The problem is that FCSH becomes slower the more memory it consumes. The time is ridicolous. It takes at the moment approx 10min to compile the whole project. With a simple application making use of this technique it takes about 1 minute – and it scales very well with the amount of cores.


Best,

Joa
Comments (16)
 
History
 
Linked Issues (0)
 
Maxim Mossienko
  Maxim Mossienko
24 Dec 2009 19:24
(7 months ago)
Joa Ebert
  Joa Ebert
24 Dec 2009 19:25
(7 months ago)
Yes it would be possible to use the Flex Compiler API with the patched HFCD version.
Alexander Doroshko
  Alexander Doroshko
27 Jan 2010 17:44
(6 months ago)
Flex parallel compilation using mxmlc/compc is done. IDEA still uses fcsh by default but you may switch to parallel compilation at Settings (Ctrl+Alt+S) -> Compiler -> Flex Compiler dialog.

In IDEA EAP 94.273 this functionality is hidden. To enable it you need to pass -Didea.flex.parallel.compilations.max=N option to IDEA's JVM. I suppose that reasonable values for N are ~ 4 - 8.
Add this option to bin\idea.exe.vmoptions file (Windows) or bin/idea.vmoptions file (other OS).
Joa Ebert
  Joa Ebert
27 Jan 2010 18:07
(6 months ago)
Nice, is this in EAP 9.0.2?
Alexander Doroshko
  Alexander Doroshko
27 Jan 2010 18:09
(6 months ago)
Yes, but not in currently available 94.192. Please wait for the next EAP.
Joa Ebert
  Joa Ebert
27 Jan 2010 18:13
(6 months ago)
Fingers crossed. We will test it immediately on Windows/Mac with our project setup.
Alexander Doroshko
  Alexander Doroshko
10 Feb 2010 15:07
(5 months ago)
new EAP is out
Kai-Philipp Schoellmann
  Kai-Philipp Schoellmann
10 Feb 2010 21:59
(5 months ago)
I tried adding the -Didea.flex.parallel.compilations.max=4 argument to the idea.properties file in the applications bin folder, as I could not find a idea.vmoptions file. After relaunching the IDE it still uses the fcsh (which still crashes again and again), so I tried it by creating an idea.vmoptions-file with that content, but still without any effect.

(Mac 10.6.2, Intellij 94.273)
Kai-Philipp Schoellmann
  Kai-Philipp Schoellmann
11 Feb 2010 03:12
(5 months ago)
I figured it out, i just added idea.flex.parallel.compilations.max=4 to the idea.properties file in the bin folder of the application package folder and it seemed to compile. It would be great if it would be possible not compile everything that was not changed after the last compile again and again.
Alexander Doroshko
  Alexander Doroshko
11 Feb 2010 11:14
(5 months ago)
Only touched modules should be recompiled because -incremental flag is passed to compiler command line parameters. Please make sure that you press Make (Ctrl+F9) but not Build->Rebuild Project.
The reason of recompilation is written in the Messages tool window. Please attach the whole its content if you suspect that recompilation is made even without changes.
Jeroen Bensch
  Jeroen Bensch
15 Feb 2010 14:21
(5 months ago)
Kai-Philipp, can you confirm that adding it to idea.properties did the trick? Because idea.vmoptions does indeed not exist on OS X.
Vladimir Krivosheev
  Vladimir Krivosheev
15 Feb 2010 14:27
(5 months ago)
OS X — edit (Show Package Contents Idea.app) Contents/Info.plist (Property List Editor via XCode or any other text editor) -> Java node, see VMOptions
Kai-Philipp Schoellmann
  Kai-Philipp Schoellmann
15 Feb 2010 14:40
(5 months ago)
Adding the setting to the idea.properties file did the trick for me.
Jeroen Bensch
  Jeroen Bensch
15 Feb 2010 15:22
(5 months ago)
So we've got conflicting solutions on OS X now then. I guess either one works.

What I'm wondering about is how this fits in when using a maven flex compiler with flexmojos. Is this supported too? Then I suppose modifying idea.properties or Java's VMOptions won't do much. I think we'd have to add idea's option for parallel compilation to the Flex Compiler Shell VM Parameters in the Project Structure's SDK?
Alexander Doroshko
  Alexander Doroshko
15 Feb 2010 15:38
(5 months ago)
Each of 3 ways of setting IDEA's VM option should work. Either create bin/idea.vmoptions file and add single line there (starting with -D), or add property to bin/idea.properties file (without -D prefix), or edit Info.plist.

This works in case of Flexmojos as well. You should not do anything with Flex SDK or Flex Compiler Shell VM Parameters
Maxim Mossienko
  Maxim Mossienko
26 Feb 2010 20:59
(5 months ago)
More convenient configuration way of parallel flex compilation is described at http://blogs.jetbrains.com/idea/2010/02/speed-up-flex-compilation/