ActiveDen

Flash IDE, compiliing with multiple SWC

111 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 1 000 and 5 000 dollars
  • Taiwan
savorks says

Hiya, I have a question about compiling with multiple SWC files included in Library Path.

In adobe’s document it says :

“If you use the Library path, be sure none of the compiled code in the SWC files is duplicated in uncompiled AS files in the Source path. The redundant code will slow down compilation of your SWF file”

And yes it does slow down the compile when compiling file have same AS with SWCs in Library.

My question is, if SWC files have same AS files/Class inside them (assume them all refer to same document), will compiler take more time to compile file or it doesn’t matter ?

i.e two SWC files both use Tween engine inside and while you check Class inside those SWC files you can see them both have Tween engine Classes inside, will that slow down compiler ?

Thanks in ahead.

34 posts
  • Bought between 1 and 9 items
  • Europe
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 50 and 99 users
  • Sold between 10 000 and 50 000 dollars
majakovskij says

It looks like the Adobe answer is your answer.

Since the swf file must have only one copy of each used class, the compiler must analyze and extract the bytecode of each to include it in the final swf.

111 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 1 000 and 5 000 dollars
  • Taiwan
savorks says

I thought there is some different,

In adobe’s document it only mention compiling “uncompilied” AS files with SWC

But I was wondering what if the file we compiling doesn’t import/use Tween Class, but in Library there are many SWC files they all use same Tween Class, and since they are SWC so Classes inside them are compiled already, will the flash compiler still take time compile those Tween Class again ?

34 posts
  • Bought between 1 and 9 items
  • Europe
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 50 and 99 users
  • Sold between 10 000 and 50 000 dollars
majakovskij says

The benefit of using swc is that the classes are already compiled, so the compiler won’t compile them again, it does only extract the bytecode from them.

The compiler is pretty smart. Only used classes are included in the swf, so if you are a huge swc and you are using just a tiny isolated class, only the bytecode of that class will be included.

Furthermore the compiler won’t include duplicated classes.

That’s what I’ve learned by making some libraries….

111 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 1 000 and 5 000 dollars
  • Taiwan
savorks says

Yap I understand compiler will only compile the necessary Classes.

I didn’t describe my question well, but what I trying to figure out is the compile “time”

Main file, imported com.SomeClass
in document class path it have a link to com.SomeClass.as file
and in its SWC Library it have a compiled file which have com.SomeClass compiled already.

In this situation, when compiling main file it will compile com.SomeClass.as again instead of using the already compiled code in SWC .

Ok, after we removed the linkage from document class path, it will use SWC ’s compiled code instead and now the compiling speed is faster, I think this is what the Adobe document point at.

And back to my question, it is when there are many SWC files included in main file’s Library, and when they all have com.SomeClass compiled inside, will that take much* longer to compile the main file ?

34 posts
  • Bought between 1 and 9 items
  • Europe
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 50 and 99 users
  • Sold between 10 000 and 50 000 dollars
majakovskij says
Yap I understand compiler will only compile the necessary Classes.

I didn’t describe my question well, but what I trying to figure out is the compile “time”

Main file, imported com.SomeClass
in document class path it have a link to com.SomeClass.as file
and in its SWC Library it have a compiled file which have com.SomeClass compiled already.

In this situation, when compiling main file it will compile com.SomeClass.as again instead of using the already compiled code in SWC .

By default the compiler should looking for from source code first, then from compiled code. So it’ll use the .as instead the bytecode of the same class.

And back to my question, it is when there are many SWC files included in main file’s Library, and when they all have com.SomeClass compiled inside, will that take much* longer to compile the main file ?
This is a different question, but the point is:
  • the compiler will looking for source code first, so it’ll use com.ComeClass.as
  • if not found, the compiler will extract the first com.SomeClass bytecode to include it in the swf
  • then it will ignore the next com.SomeClass present in further swcs.

hope it does answer your questions.

111 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 1 000 and 5 000 dollars
  • Taiwan
savorks says
  • if not found, the compiler will extract the first com.SomeClass bytecode to include it in the swf
  • then it will ignore the next com.SomeClass present in further swcs.
  • Thank you majakovskij,
    This help me understand it more clearly now.

    And according to this rule, I can consider the answer is it won’t take the compile time much longer ? ( since it will ignore next com.SomeClass present in further swcs)

    1518 posts
    • Bought between 1 and 9 items
    • Europe
    • Exclusive Author
    • Has been a member for 5-6 years
    • Referred between 100 and 199 users
    • Sold between 50 000 and 100 000 dollars
    dSKY says

    as I understand , duplicate class version , won’t be compiled, but it will affect the compile time. Because, compiler “scans” the swc to see what’s inside.
    If you have a swc with 1000 different classes, and you only need 2 , it will take more time, than to have a compiler with only those 2 classes.

    34 posts
    • Bought between 1 and 9 items
    • Europe
    • Exclusive Author
    • Has been a member for 3-4 years
    • Referred between 50 and 99 users
    • Sold between 10 000 and 50 000 dollars
    majakovskij says
    as I understand , duplicate class version , won’t be compiled, but it will affect the compile time. Because, compiler “scans” the swc to see what’s inside.
    If you have a swc with 1000 different classes, and you only need 2 , it will take more time, than to have a compiler with only those 2 classes.

    Yes that’s true, but consider that the compiler will scan only the ‘manifesto.xml’ file included in any swc library to find duplicated classes, so it is a pretty fast process.

    111 posts
    • Bought between 1 and 9 items
    • Exclusive Author
    • Has been a member for 3-4 years
    • Sold between 1 000 and 5 000 dollars
    • Taiwan
    savorks says

    I had make a test and seems the compiler only scan for package path and class name when compiling and doesn’t compare methods/properties inside.

    So if this is true ( can’t find official document about this tho ), as long as it don’t recomplie class or scan whole script, it should be fine :)

    For example, while compiling from papervision SWC pack(didn’t count how many classes inside but should be a lot), this got compiled in no time
    import org.papervision3d.events.FileLoadEvent;
    var evt:FileLoadEvent = new FileLoadEvent('someEvent');
    
    by
    by
    by
    by
    by