[
https://issues.apache.org/jira/browse/FLEX-34859?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14561125#comment-14561125
]
Alex Harui commented on FLEX-34859:
-----------------------------------
In my understanding, every AS class is represented in the SWF as a set of data
structures that reference the byte code of the method bodies, plus more "class
init" byte code that runs once to set up the class to be instantiated. As you
add more and more classes to a SWF, the set of data structures gets larger as
does the SWF.
It is also my understanding that when you launch an AIR app, the SWF gets read
fully into memory. When you launch a SWF in a browser, the SWF is streamed in
over time and once a frame full of SWF is loaded that frame starts executing.
I believe that AIR does not stream in the SWF, it assumes it can just load the
whole SWF into memory quickly.
Then, the AIR (or Flash) runtime runs through the entire set of data
structures, but it does not run class init code until the class is actually
used.
IMO, the time to run through the entire set of data structures is fast so
adding another 1000 classes shouldn't be significant, especially compared to
separately opening an external file to load even a fraction of those classes.
I don't have much experience with mobile devices and how fast they can load an
additional 1MB into memory from application storage, but I'd imagine that would
be fast as well since there is no spinning media.
So, you'd have to run your own tests, but the effect on startup time of baking
in 100 extra swfs will depend on how many of those swfs would get loaded at
startup, how big they are, and how many classes they share. You could even see
an performance improvement if you normally loaded many of those SWFs and they
share a lot of classes.
There is a poorly documented way of baking each module SWF into a separate
frame in the SWF. Flex SWFs are typically two-frame SWFs with a small
first-frame preloader UI and the rest of your app is packed into the second
frame. In the browser, the preloader shows until the huge second frame is
downloaded. If that code then has to wait for other modules to be fetched off
the network, it can delay startup. By baking modules into third and fourth
frames in a SWF, the app can supposedly get started while the modules are
downloading in the same network request. The downside is that if you need the
last module in the SWF, you have to wait for all other frames/modules to finish
downloading before you can use it. I have no idea of that would help in an
AIR/Mobile scenario or not, but wanted to make sure you knew that was an option.
And, of course, the downside of baking anything in is that you don't get the
benefits of asynchronous development and zero-install auto-updating.
> Compilation AIR application of IOS with modules
> -----------------------------------------------
>
> Key: FLEX-34859
> URL: https://issues.apache.org/jira/browse/FLEX-34859
> Project: Apache Flex
> Issue Type: Question
> Components: Modules
> Reporter: Pedro
> Labels: air, compilation, flex, iOS, module
>
> Hi there,
> In my company we have an AIR application for IOS (we use Flex 4.12 and AIR
> 13.0) , this application needs to use modules at run time downloaded from a
> server, Apple does not allow this feature so I've seen that I can compile at
> the same time my application with SWF’s of each module by ADT command in a
> terminal.
> Lets remember that using Flex mobile we can generate applications for
> Android, IOS, Black Berry and AIR. My question is whether, once compiled
> application and generated the IPA, the performance of the application in IOS
> will be the same as if executed under a build Adobe AIR? That is, although I
> compile my application with 100 SWF's, each of them not be loaded until it is
> claimed by the main application as when you run the application with AIR,
> isn´t it?
> Thanks.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)