组织 Flex 应用程序以提高编译性能的最佳方式?

发布于 2024-09-07 17:02:45 字数 253 浏览 2 评论 0原文

我正准备重组&重构 Flash Builder 应用程序。重组的目标是 1.) 尽可能快地保持我正在处理的项目部分的编译时间,2.) 将不相关的部分分开以便代码重用。如果需要权衡的话,目标#1 胜过目标#2。

目前,该应用程序在一个项目中拥有资产,在另一个项目中拥有核心功能 AS3,在链接到其他两个项目的第三个项目中拥有 MXML。

将资源/代码移至 SWC 库有助于编译时间吗?将资产编译为 swf 并将其嵌入到主应用程序中怎么样?还有其他技术吗?

I'm preparing to reorganize & refactory a Flash Builder application. The goals of the reorg are 1.) keep compile times for the part of the project I'm working on as fast as possible, 2.) keep the unrelated parts separate for code reuse. Goal #1 trumps goal #2 if there's a trade-off.

Currently, the app has assets in one project, core functionality AS3 in another project, and the MXML in a third project that links to the other two.

Would moving resources/code into swc libraries help compile time? What about compiling assets into an swf and embedding that into the main application? Any other techniques?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

追风人 2024-09-14 17:02:50

正如 Maxim 所描述的,模块绝对是解决问题的方法。除了他的建议(这些建议都很可靠)之外,这里还有一些其他提示:

  • 将样式提取到单独的项目中,并将 .css 编译为 SWF。在运行时加载 SWF。
  • 首先按业务功能构建包,然后按 MVC 角色构建包,

    例如:不要使用 com.myapp.model.userconfig.UserOptions,而是使用 com.myapp.userconfig.model.UserOptions。强制要求包只能引用其同级包或 com.myapp.core.*

    这样,每个包都是一个自包含模块,它只引用自身或核心库。

  • 考虑使用 Hellfire 编译器,它可以在多个 CPU 上并行进行编译
  • 。已经可以考虑转向 Flex 4 SDK,它具有多项编译器性能改进,特别是在编译多个 SWC 方面。

Modules are definitely the way to go here, as Maxim has described. Further to his advice, which is all solid, here's some other tips:

  • Extract styles out to a separate project, and compile the .css to a SWF. Load the SWF at runtime.
  • Structure your packages by business function first, MVC role second,

    Eg: Rather than com.myapp.model.userconfig.UserOptions, use com.myapp.userconfig.model.UserOptions. Enforce that packages can only reference their siblings, or com.myapp.core.*.

    This way, each package is a self contained module, which only references itself, or the core library.

  • Consider the Hellfire Compiler, which can farm your compilation over several CPU's in parallel
  • If not already, consider moving to the Flex 4 SDK, which has several compiler performance improvements, especially around compiling multiple SWC's.
各自安好 2024-09-14 17:02:48

我们遇到了同样的问题,应用程序编译时间超过 1 分钟。

这是我们的解决方案:

  1. 有一个核心库,其中包含带有静态属性的 Core 类,例如:Core.resourceManager:IResourceManagerCore.stringManager:IStringManager等。
  2. 主应用项目包含Core Library并为所有Core.someProp提供实现。这可以通过一些隐藏方法(例如 Core.setImpelentation())来完成。
  3. 使用核心库向应用程序贡献其显示/逻辑的模块数量不受限制。重要的:
    1. 每个模块都是一个单独的 Flash Builder 项目
    2. 模块链接核心库作为外部(它包含在主应用程序中)
    3. 模块有描述它的 XML 文件,例如应用程序控制栏中的名称和图标。它允许在启动时不加载所有模块。
    4. 用户应该能够选择他想要使用的模块。这也将有助于您的发展。
  4. 您可以选择创建Lib Library,并在其中包含模块之间通用且可以使用核心库实现的所有类。

结果令人难以置信 - 您的应用程序变得低耦合,开放/编译时间减少,API 变得更加清晰。利润!

We had the same problem, application compile time was more than 1 minute.

Here is our solution:

  1. There is a Core Library that contains class Core with static properties like: Core.resourceManager:IResourceManager, Core.stringManager:IStringManager, etc.
  2. Main application project includes Core Library and provides implementation for all Core.someProp. This can be done via some hidden method like Core.setImpelentation().
  3. There are unlimited number of Modules that use Core Library to contribute their display / logic to the application. Important:
    1. Each Module is a separate Flash Builder project
    2. Module link Core Library as external (it's included in Main App)
    3. Module has XML-file that describes it, example it's name and icon in application control bar. It allows not to load all modules at start.
    4. User should be able to choose which modules he would like to use. This will also help you in development.
  4. You can optionally create Lib Library and include in it all classes that are common between modules and can be implemented using Core Library.

The result is incredible - you application becomes low-coupled, open/compile time decreases, APIs become more clear. Profit!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文