简体   繁体   English

将GWT编译为JavaScript需要花费大量时间

[英]GWT compile to javascript takes lot of time

I have large project and it takes nearly 15 mins to compile through ANT. 我有一个大型项目,通过ANT进行编译大约需要15分钟。 You can see I have already tried with parrallel with no success. 您可以看到我已经尝试使用parrallel并没有成功。 Also experimented with localWorkers but didn't observe much difference. 还对localWorkers进行了实验,但并没有太大差异。 I am using i3 processor with 4 GB RAM. 我正在使用具有4 GB RAM的i3处理器。 Please suggest all optimizing parameters for compiling this code quickly. 请提出所有优化参数以快速编译此代码。 But it has to be production quality :). 但这必须是生产质量:)。

<target name="largeProject-gwtc"  depends="largeProject-compile" description="GWT compile to JavaScript">
    <!--parallel threadsperprocessor="1"-->
        <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
            <classpath>
                <pathelement location="../common/src"/>
                <pathelement location="../largeProject/src"/>
                <pathelement location="build/largeProject/war/WEB-INF/classes"/>
                <fileset dir="build/largeProject/war/WEB-INF/lib" includes="*.jar"/>
                <pathelement location="${gwt.sdk}/gwt-user.jar"/>
                <fileset dir="${gwt.sdk}" includes="gwt-*.jar"/>
            </classpath>
            <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
            <jvmarg value="-Xmx2048M"/>
            <jvmarg value="-XX:MaxPermSize=1024m"/>
            <arg line="-war"/>
            <arg value="build/largeProject/war"/>
            <!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
            <arg line=""/>
            <arg value="com.test.web.largeProject"/>
        </java>
    <!--/parallel-->
</target>

Not really. 并不是的。 You can do some tricks for speeding up compiler but that applies mainly to development (not production ready state). 您可以采取一些技巧来加快编译器的速度,但这主要适用于开发(不适用于生产就绪状态)。

So nope, no magic is going to happen to save you. 因此,不会,没有魔术会拯救您。 GWT compiler is slow and that's currently one of the biggest downsides of GWT. GWT编译器运行缓慢,这是GWT的最大缺点之一。

On of the things you can try is using a 64bit JDK, at if possible version 7 of said JDK. 您可以尝试使用64位JDK,如果可能的话,请使用所述JDK的版本7。 I've tried this on existing projects which were previously compiled with 32 bit versions of either JDK 6 or 5, and just by switching to JDK 7 64bit I had some decent speed gains, sometimes up to 30-40%. 我已经在以前用32位版本的JDK 6或5编译过的现有项目上进行了尝试,仅通过切换到64位的JDK 7,我就获得了不错的速度提升,有时可以达到30-40%。 Also, if possible, do this one a Windows machine, preferrably a Windows XP 64 bit, or second best a Window 7 64bit. 另外,如果可能,请在一台Windows机器上执行此操作,最好是Windows XP 64位,或者最好是Windows 7 64位。 With the risk of being flamed over by the people on this forum I'm gonna say this: from what I've tried so far, the JDK implementations are fastest on Windows, followed by Linux and finally the OS X JDK implementations are the slowest. 冒着被该论坛上的人们激怒的风险,我要说的是:从到目前为止的经验来看,JDK实现在Windows上最快,其次是Linux,最后是OS X JDK实现是最慢的。 This might just be true for the stuff I'm doing, but give it a shot why dontcha. 这可能对我正在做的事情来说是正确的,但请试一下为什么不这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM