macos 在 Flex Builder 3 中加快编译时间有什么建议吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33768/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 05:52:49  来源:igfitidea点击:

Any advice for speeding up the compile time in Flex Builder 3?

apache-flexmacosflexbuildercompilation

提问by onekidney

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?

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

采纳答案by mikechambers

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".

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

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]

网格@adobe.com

回答by Clement

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:

  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 (max heap size)

-Xmx(最大堆大小)

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

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

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

-XX:+UseSerialGC 或 -XX:+UseParallelGC(或其他非串行 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.

在运行 Flex 编译器时,-server 始终比 -client 性能高出约 30%。-XX:+UseParallelGC 打开并行垃圾收集器。非常适合多核计算机以及当计算机仍有 CPU 周期可用时。

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).

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

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

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

Hope this helps.

希望这可以帮助。

-Clement

-克莱门特

回答by Theo

There's no need to use mxmlcon 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.

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

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 optimizeto 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).

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

I very much prefer using mxmlcon 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 minefor more info on that.

mxmlc与 Flex Builder 相比,我更喜欢在命令行上使用(通过 Ant)。虽然我不认为后者编译更慢,但感觉各方面都比较迟钝。使用 Ant 还可以做更多的事情,而不仅仅是在构建时进行编译和条件编译(仅在源代码实际更改的情况下才编译 SWF 或 SWC)。查看我的博客文章以获取更多信息。

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.

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

回答by Richard Szalay

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

缓慢的编译时间通常是由大量嵌入资源([Embed] 或 @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/]

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

回答by Stanislav Zayarsky

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

我用工作区创建了 RAM 磁盘,它提供了 10% 的更好的编译时间。不多,但有些东西。

回答by Ted Naleid

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.

如果可能,您希望您的计算机上至少有 4 个演出,并确保覆盖 eclipse/flexbuilder 为应用程序提供的默认内存设置。

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:

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

-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).

进入 eclipse/flexbuilder 首选项并检查 Windows->Preferences->General 下的“显示堆状态”框也是值得的(这是在带有 FB 插件的 Eclipse 中,我假设它也适用于独立 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).

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

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

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

回答by Suzanne

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.

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

回答by Zefiro

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

我总是禁用 Flex 的“自动编译”。它编译太多,耗时太长,所以打断了我的工作。

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.

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

Unfortunately, the default Flex Navigator does not support working sets. But you can open the Package Explorerwith 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.

不幸的是,默认的 Flex Navigator 不支持工作集。但是您可以使用Window / Show View / ...打开Package Explorer。单击右上角的小白色向下箭头,然后选择Top Level Elements: Working Sets。然后您可以添加工作集(又名项目组)。每个项目至少需要在一个工作集中(“其他项目”是默认值),但可以在多个工作集中。

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.

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

回答by Cornel Creanga

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.

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

回答by Jiri Tobisek

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.

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