启动时间很短 [英] Slow startup time
问题描述
我并不在意执行时间,但缓慢的启动正在使它无法在Groovy中为我开发。
在我的机器上使用Groovy和Ruby启动和运行一个空脚本之间的简单比较:
$ time groovy -e
real 0m5.678s
用户0m6.468s
sys 0m0.456s
$ time ruby -e
real 0m0.023s
user 0m0.020s
sys 0m0.004s
我使用存储库中的标准软件包来运行Ubuntu 11.10。
$ groovy -v
Groovy版本:1.7.10 JVM:1.6.0_23
$ cat / etc / lsb-release
DISTRIB_ID = Ubuntu
DISTRIB_RELEASE = 11.10
DISTRIB_CODENAME = oneiric
DISTRIB_DESCRIPTION =Ubuntu 11.10
$ java -version
java版本1.6.0_23
OpenJDK Runtime Environment(IcedTea6 1.11pre)( 6b23〜pre11-0ubuntu1.11.10.1)
OpenJDK 64位服务器虚拟机(内置20.0-b11,混合模式)
这是JVM开销的结合,加上groovy自己的启动时间。将 -noverify
标志添加到JVM选项会关闭字节码验证,这会产生显着差异。设置 JAVA_OPTS
环境变量为 -noverify
以便groovy使用它。
还有一个在后台运行服务器进程的项目来解决这个问题: http:// kobo.github.com/groovyserv/
Is there any way to speed up the startup time of Groovy? (Except using the some kind of separate running Groovy process, as has been suggested).
I don't care much about execution times, but the slow startup is making it impossible to develop in Groovy for me.
A simple comparison between starting and running an empty script, using Groovy and Ruby on my machine:
$ time groovy -e ""
real 0m5.678s
user 0m6.468s
sys 0m0.456s
$ time ruby -e ""
real 0m0.023s
user 0m0.020s
sys 0m0.004s
I am running Ubuntu 11.10 using the standard packages in the repositories.
$ groovy -v
Groovy Version: 1.7.10 JVM: 1.6.0_23
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.10
DISTRIB_CODENAME=oneiric
DISTRIB_DESCRIPTION="Ubuntu 11.10"
$ java -version
java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10.1)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
This is a combination of JVM overhead, plus groovy's own startup time. Adding the -noverify
flag to the JVM options turns off bytecode verification, which makes a noticeable difference. Set the JAVA_OPTS
environment variable to -noverify
to get groovy to use it.
There's also project to run a server process in the background to get around this: http://kobo.github.com/groovyserv/
这篇关于启动时间很短的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!