jastrachan | 16 Mar 11:14 2005
Picon

Re: [groovy-dev] Why groovy so slow?

If startup time is an issue, you could consider using the binary 
executable for groovy. Joe Walnes submitted a build which uses GCJ to 
turn groovy into a binary executable with a low startup time.

On 16 Mar 2005, at 10:12, Peter Reilly wrote:
> Russel Winder wrote:
>
>> I have not done any actual experiments so I have no data but my
>> hypothesis / expectation is that the apparent long execution time of
>> Groovy scripts is principally down to the slow startup time of the JVM
>>
> This is not correct, java is slower to start up than python or ruby, 
> but
> it is not extremely slow (as seen by a human):
> > time java -cp . Hello
> hello
>
> real    0m0.105s
> user    0m0.042s
> sys     0m0.022s
> > time python hello.py
> hello
>
> real    0m0.028s
> user    0m0.015s
> sys     0m0.013s
> > time ruby hello.rb
> hello
>
> real    0m0.008s
> user    0m0.004s
> sys     0m0.003s
>
>
> There is a startup cost for groovy language scripts in ant of over a
> second on my machine. This startup cost is not shared by
> beanshell or by javascript (rhino), (the cost is shared by jruby!).
>
> <project>
>  <target name="beanshell">
>    <script language="beanshell">
>      System.out.println("hello");
>    </script>
>  </target>
>  <target name="groovy">
>    <script language="groovy">
>      System.out.println("hello")
>    </script>
>  </target>
> </project>
>
> preilly <at> angel:~/tmp/timing > time ant groovy
> Buildfile: build.xml
>
> groovy:
>   [script] hello
>
> BUILD SUCCESSFUL
> Total time: 1 second
>
> real    0m2.232s
> user    0m2.393s
> sys     0m0.324s
> preilly <at> angel:~/tmp/timing > time ant beanshell
> Buildfile: build.xml
>
> beanshell:
>   [script] hello
>
> BUILD SUCCESSFUL
> Total time: 0 seconds
>
> real    0m0.950s
> user    0m0.806s
> sys     0m0.108s
>
> I can write simple beanshell
> tasks/types and compile them and run them over 200 html files, in less 
> time that
> it takes to startup a "hello world" groovy script. So while groovy may 
> be faster
> and more expressive after the startup time, it does not matter in my 
> case which
> is to write small throw-away scripts quickly.
>
> Peter
>
>
>

James
-------
http://radio.weblogs.com/0112098/


Gmane