对于加快 Flex Builder 3 中的编译时间有什么建议吗?

发布于 2024-07-04 16:53:18 字数 100 浏览 9 评论 0 原文

我在 Mac 上运行 Flex Builder 3,随着项目的增长,编译时间变得越来越长。 我正在使用一些 SWC,并且有相当多的代码,但每天构建和崩溃不应该花费几分钟的时间,不是吗?

I run Flex Builder 3 on a mac and as my project grows - the compile time gets longer and longer and longer. I am using some SWC's and there is a fair amount of code but it shouldn't take minutes to build and crash daily should it?

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

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

发布评论

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

评论(14

剩一世无双 2024-07-11 16:53:18

我总是禁用 Flex 的“自动编译”。 它编译的内容太多,花费的时间太长,因此中断了我的工作。

如果您有许多不同的项目文件并且所有这些文件都需要重新编译,但您还打开了其他项目并且不想在构建时总是关闭它们,那么您还可以使用 Eclipse 工作集。

不幸的是,默认的 Flex Navigator 不支持工作集。 但是您可以使用Window / Show View / ...打开Package Explorer。 单击右上角的白色向下小箭头,然后选择顶级元素:工作集。 然后,您可以添加工作集(也称为项目组)。 每个项目至少需要位于一个工作集中(默认为“其他项目”),但也可以位于多个工作集中。

现在,通过Project / Buildworking Set / ...,您可以指示 Eclipse 构建该工作集中的所有项目,但不构建其他项目。 如果您怀疑您的项目引用有时会被破坏,这尤其有用 - 否则构建“最顶层”项目应该自动触发后续构建。

I always disable "automatic compile" for Flex. It compiles too much, takes too long, and so interrupts my work.

If you have many different project files and all of those needs to be recompiled, but you also have other projects open and don't want to close them always you're doing a build, you can also use Eclipse Working Sets.

Unfortunately, the default Flex Navigator does not support working sets. But you can open the Package Explorer with Window / Show View / .... Click on the little white downward arrow to the topright and select Top Level Elements: Working Sets. You can then add Working Sets (aka groups of projects). Each project needs to be in at least one working set ("Other Projects" being the default), but can be in several.

Now with Project / Build Working Set / ... you can instruct Eclipse to build all the projects in this working set, but none of the others. This is especially useful if you suspect your project references to be sometimes broken - otherwise building the 'topmost' project should trigger subsequent builds automatically.

Oo萌小芽oO 2024-07-11 16:53:18

无需在命令行上使用 mxmlc 即可添加编译器标志。 在 Flex Navigator 中右键单击您的项目,选择 Properties,然后在出现的对话框中选择 Flex Compiler。 您可以在其中添加任何额外的编译器标志。

但不确定还有很多事情要做,更多的代码意味着更多的编译时间,事情就是这样。 如果您没有进行发布构建(或者在 Flex Builder 中称为任何名称),那么您的编译器设置不太可能包含 optimize。 更好的选择是 -incremental (它只重新编译已更改的部分)和 -keep- generated-actionscript (它阻止编译器删除它所生成的 ActionScript 文件)已从应用程序的 MXML 文件生成)。

与 Flex Builder 相比,我非常喜欢在命令行上使用 mxmlc(通过 Ant)。 虽然我不认为后者编译速度更慢,但在各方面都感觉更迟缓。 使用 Ant 还可以不仅仅在构建时进行编译,还可以进行条件编译(如果源代码实际上已更改,则仅编译 SWF 或 SWC)。 查看 博客文章我的了解更多信息。

您可以尝试使用 Flex Compiler Shell,这是另一个可以加速编译速度的命令行工具事情发生了。 基本上,它会尝试在构建之间保留尽可能多的内存,因此无需等待 JVM 启动之类的事情(Flex 编译器是一个 Java 应用程序)。 另一方面,这就是 Flex Builder 所做的事情。

There's no need to use mxmlc on the command line just to be able to add compiler flags. Right click your project in the Flex Navigator, select Properties and then Flex Compiler in the dialog that appears. There you can add any extra compiler flags.

Not sure that there's very much to do though, more code means more compile time, that's just the way it is. If you're not doing a release build (or whatever it's called in Flex Builder) it's unlikely that your compiler settings include optimize to begin with. Better choices to try would be -incremental (which only recompiles the parts that have changed) and -keep-generated-actionscript (which stops the compiler from deleting the ActionScript files it has generated from your application's MXML files).

I very much prefer using mxmlc on the command line (by way of Ant) compared to Flex Builder. Although I don't think that the latter compiles any slower, it feels more sluggish in every way. Using Ant also makes it possible to do more than just compilation when building, and conditional compilation (only compile a SWF or SWC if the source code has actually changed). Check out a blog post of mine for more info on that.

What you could try is the Flex Compiler Shell, another command line tool that can speed things up. Basically it tries to keep as much as possible in memory between builds, so no need to wait for things like the JVM starting up (the Flex compiler is a Java application). On the other hand this is sort of what Flex Builder does anyway.

孤君无依 2024-07-11 16:53:18

首先评论一下一些回复:

  1. 在 Flex Builder 中不需要显式指定 -incremental,因为它默认使用增量编译。

  2. -keep- generated-actionscript 是一个性能杀手,因为它指示编译器在编译过程中写出为 MXML 组件生成的 AS3 代码。 编译过程中的文件 I/O 意味着不必要的暂停和低 CPU 利用率。

  3. -optimize 会减慢链接速度,因为它指示链接器生成较小的 SWF。 请注意,-optimize=true|false 对构建 SWC 没有任何影响,因为 SWC 是库,必须不进行优化。

  4. 我很少搞乱 JVM 设置,因为 JVM 非常了解它的工作,并且在运行时可以很好地自我调整。 大多数人通过设置各种 GC 调整参数使事情变得更糟。 也就是说,大多数人都理解并正确设置了 3 个设置以供其使用:

-Xmx(最大堆大小)

-server 或 -client(HotSpot 服务器或客户端 VM)

-XX:+UseSerialGC 或 -XX:+UseParallelGC(或其他) 运行 Flex 编译器时,

服务器的性能始终优于客户端约 30%。
-XX:+UseParallelGC 打开并行垃圾收集器。 非常适合多核计算机以及当计算机仍有空闲 CPU 周期时。

您可能还想查看 HellFire 编译器守护程序 (http://bytecode-workshop.com/)。 它使用多个处理器核心同时编译多个Flex应用程序。 您还可以通过套接字在第二台机器上运行编译器(假设您的第二台机器具有更快的 CPU 和更多内存)。

在我看来,使用更多的模块而不是库并使用 HFCD。

希望这可以帮助。

-克莱门特

First of all, comments on some of the response:

  1. There is no need to explicitly specify -incremental in Flex Builder because it uses incremental compilation by default.

  2. -keep-generated-actionscript is a performance killer because it instructs the compiler to write out AS3 codes generated for MXML components in the middle of the compilation. File I/O in the middle of a compilation means unnecessary pauses and low CPU utilizations.

  3. -optimize slows down linking because it instructs the linker to produce smaller SWFs. Note that -optimize=true|false doesn't have any effect on building SWCs because SWCs are libraries and have to be unoptimized.

  4. I rarely mess with JVM settings because JVM knows its jobs well and tunes itself quite well at runtime. Most people make matter worse by setting various GC tuning parameters. That said, there are 3 settings most people understand and set correctly for their usage:

-Xmx (max heap size)

-server or -client (HotSpot Server or Client VM)

-XX:+UseSerialGC or -XX:+UseParallelGC (or other non-serial GC)

-server consistently outperforms -client by about 30% when running the Flex compiler.
-XX:+UseParallelGC turns on the parallel garbage collector. ideal for multicore computer and when the computer still has CPU cycles to spare.

You may also want to check out HellFire Compiler Daemon (http://bytecode-workshop.com/). It uses multiple processor cores to compile multiple Flex applications at the same time. You can also run the compiler on a second machine via sockets (assuming that your second machine has faster CPUs and more memory).

In my opinion, use more modules than libraries and use HFCD.

Hope this helps.

-Clement

萌梦深 2024-07-11 16:53:18

您可以使用工作集仅编译属于您要更改的应用程序一部分的一组组件,而不是整个项目

http://livedocs.adobe.com/flex/3/html/help.html?content=build_6.html

You can use WORKING SETS to compile just a set of your components that are part of the application that you are changing and not the whole project

http://livedocs.adobe.com/flex/3/html/help.html?content=build_6.html

不喜欢何必死缠烂打 2024-07-11 16:53:18

除了已经提到的建议之外,请关闭所有已打开但未使用的项目。

Rich 单击导航器视图中的项目并选择“关闭不相关的项目”。

根据您打开的项目数量,这可以显着提高编译时间以及整体性能。

Mike Chambers

[电子邮件受保护]

In addition to the suggestions already mentioned, close any projects that you have open that you are not using.

Rich click on the Project in the Navigator view and select "Close Unrelated Projects".

Depending on how many projects you have open, this can lead to a significant improvements in compile time, as well as all around performance.

mike chambers

[email protected]

↙厌世 2024-07-11 16:53:18

并且我浪费了大量时间等待 MXMLC 编译器完成其工作,直到我找到了 Flex Compiler SHell:

我不使用 Flex Builder,但我每天都使用 Flex SDK 编译器, zarate.tv/2008/12/07/theres-something- Called-flex-compiler-shell/" rel="nofollow noreferrer">http://blog.zarate.tv/2008/12/07/theres-something-名为-flex-compiler-shell/

虽然理论上 Flex Builder 已经使用了这种优化,但可能值得检查。

I don't use Flex Builder, but I use the Flex SDK compiler everyday and I was wasting tons of time waiting for the MXMLC compiler to do its job until I found Flex Compiler SHell:

http://blog.zarate.tv/2008/12/07/theres-something-called-flex-compiler-shell/

Although in theory Flex Builder already uses this optimizations, might be worth checking.

半暖夏伤 2024-07-11 16:53:18

正如 Clement 所说,使用 HellFire 编译器守护进程。 如果您的机器上有多个模块和更多 CPU 核心,它可以并行编译它们。 另一种选择是使用提供相同功能的 IntelliJ(商业版本)。

As Clement said, use the HellFire Compiler Daemon. If you have multiple modules and more CPU cores on your machine it can compile them in parallel. Another option is to use IntelliJ (the commercial version) which offers the same feature.

阪姬 2024-07-11 16:53:18

SDK 4.xx 引入了愚蠢的错误(请参阅 Adob​​e bugsystem,问题 FB-27440),这会导致使用 SVN 或 CVS 元数据的项目编译速度比使用 SDK 3.xx 慢得多。有关如何修复的方法,请参阅 这里

The SDK 4.x.x introduced silly bug (see Adobe bugsystem, issue FB-27440), which causes projects with SVN or CVS meta data compile much slower than with SDK 3.x.x. On how it can be fixed, see here.

我为君王 2024-07-11 16:53:18

您可能想探索 Flex SDK 中的命令行编译器 mxmlc。 我记得,Flex Builder 3 似乎隐藏了所有编译器详细信息,但也许您可以附加一些参数来帮助您加快编译速度。

例如,您可能想要设置 optimize=false ,这将跳过优化字节码的步骤(也许会减少编译时间)? 当然,这是以实际应用程序的性能和文件大小为代价的。

有关 mxmlc 的更多文档可以在以下位置找到:http: //livedocs.adobe.com/flex/3/html/compilers_13.html

祝你好运!

You may want to explore the command-line compiler found in the Flex SDK, mxmlc. As I recall, Flex Builder 3 seems to hide all the compiler details, but perhaps there are arguments you can append that will help you speed up the compilation.

For example, you may want to set optimize=false which will skip the step of optimizing the bytecode (perhaps reducing compilation time)? This of course comes at the price of performance and file size of the actual application.

More documentation on mxmlc can be found at: http://livedocs.adobe.com/flex/3/html/compilers_13.html.

Good luck!

半暖夏伤 2024-07-11 16:53:18

通常第一个构建花费的时间最长,之后就很快了。 那是使用 Vista x64 w/ core 2 duo。

否则,我几乎可以肯定 Intel Core i7 Extreme Edition 965 3.2GHz 升级处理器会很好地加快您的 Flex 构建速度.. :) :) :)

Usually the first build takes the longest, and then it's pretty quick after that. That's using Vista x64 w/ core 2 duo.

Otherwise, I am nearly certain a Intel Core i7 Extreme Edition 965 3.2GHz upgrade processor would speed your Flex building up nicely .. :) :) :)

堇年纸鸢 2024-07-11 16:53:18

编译时间缓慢通常是由大量嵌入资源([Embed] 或 @Embed)引起的。

本文的选项 2 可能对您有帮助:[http://www.rogue-development.com/blog2/2007/11/slow-flex-builder-compile-and-refresh-solution-modules/]

Slow compile time is most often caused by having large numbers of embedded resources ([Embed] or @Embed).

Option 2 on this article might help you: [http://www.rogue-development.com/blog2/2007/11/slow-flex-builder-compile-and-refresh-solution-modules/]

不必在意 2024-07-11 16:53:18

转到项目 -> 属性 -> Flex 应用程序。 每次都会编译列出的所有应用程序(即使您有默认设置)。 如果您删除除默认文件之外的所有内容(不用担心,它不会删除实际文件),它只会编译默认应用程序。 这使我的速度显着加快。 如果您更改默认应用程序,它会将其添加到 Flex 应用程序列表中 - 增加您的编译时间。 您将需要维护此列表以获得最快的编译。

Go to Project->Properties->Flex Applications. All of the applications listed are compiled each time (even though you have a default set). If you remove everything but the default (don't worry, it won't delete the actual files), it only compiles the default app. This resulted in a significant speed up for me. If you change your default app, it ADDs it to the Flex Applications list - adding to your compile time. You will need to maintain this list to get the quickest compile.

瞄了个咪的 2024-07-11 16:53:18

如果可能的话,您的计算机上至少需要 4 GB,并确保覆盖 eclipse/flexbuilder 为应用程序提供的默认内存设置。

如果您不确定如何执行此操作,可以在 /Applications 中找到 flexbuilder 应用程序,右键单击并选择“显示包内容”。 然后进入内容文件并编辑 eclipse.ini 文件。 编辑该文件的内存设置至少为:

-vmargs -Xms768m -Xmx768m -XX:PermSize=128m -XX:MaxPermSize=128m 

还值得进入 eclipse/flexbuilder 首选项并检查 Windows-> 首选项 -> 常规下的“显示堆状态”框(这是在带有 FB 插件的 Eclipse 中) ,我假设它也适用于独立 FB)。

这会在窗口右下角显示当前内存,并有一个小垃圾图标,以便您可以强制进行垃圾回收。

我还建议在文件更改时关闭项目的自动构建(您可以使用 cmd-B 强制构建)。

我们有一个包含相当多模块文件的大型项目,并且 FlexBuilder 3 中的性能通过这些步骤表现得不错。

You want at least 4 gigs on your computer if possible, and make sure to override the default memory settings that eclipse/flexbuilder gives to the application.

If you're not sure how to do this, you can find the flexbuilder app in /Applications, right click and choose "Show Package Contents". Then go into the contents file and edit the eclipse.ini file. Edit that file have memory settings of at least:

-vmargs -Xms768m -Xmx768m -XX:PermSize=128m -XX:MaxPermSize=128m 

It's also worthwhile to go into the eclipse/flexbuilder preferences and to check the "Show heap status" box under Windows->Preferences->General (This is in eclipse with the FB plugin, I'm assuming it's also there for standalone FB).

This shows the current memory in the lower right of the window and has a little trash icon so you can force garbage collection.

I'd also suggest turning off automatic building of the project when your files change (you can force a build with cmd-B).

We had a huge project with quite a few modules files and performance in FlexBuilder 3 was decent with these steps.

鹿港巷口少年归 2024-07-11 16:53:18

我使用工作区创建了 RAM 磁盘,它可以节省多达 10% 的编译时间。 不多,但有些东西。

I created RAM Disk with workspace and it gives up to 10% of better compilation time. Not much, but something.

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