62 messages in org.codehaus.groovy.devRe: [groovy-dev] Groovy performance: ...
FromSent OnAttachments
Alex Tkachman19 Feb 2008 02:09 
Steven Devijver19 Feb 2008 02:37 
Alexandru Popescu ☀19 Feb 2008 02:57 
Alex Tkachman19 Feb 2008 03:03 
Patric Bechtel19 Feb 2008 03:12 
Guillaume Laforge19 Feb 2008 03:25 
Guillaume Laforge19 Feb 2008 03:26 
Patric Bechtel19 Feb 2008 05:05 
Gavin Grover19 Feb 2008 05:51 
Steven Devijver19 Feb 2008 05:52 
Guillaume Laforge19 Feb 2008 05:54 
Tom Nichols19 Feb 2008 06:26 
Alex Tkachman19 Feb 2008 06:28 
Guillaume Laforge19 Feb 2008 06:35 
Tom Nichols19 Feb 2008 07:03 
Guillaume Laforge19 Feb 2008 07:38 
Chanwit Kaewkasi19 Feb 2008 07:52 
Charles Oliver Nutter19 Feb 2008 08:49 
Steven Devijver19 Feb 2008 10:03 
Charles Oliver Nutter19 Feb 2008 11:38 
Steven Devijver19 Feb 2008 12:11 
Alex Tkachman19 Feb 2008 12:39 
Alex Tkachman19 Feb 2008 12:48 
tugwilson19 Feb 2008 13:36 
Alex Tkachman19 Feb 2008 20:51 
Guillaume Laforge20 Feb 2008 02:10 
Jochen Theodorou20 Feb 2008 09:46 
Martin C. Martin20 Feb 2008 17:25 
Guillaume Laforge21 Feb 2008 01:35 
Tom Nichols21 Feb 2008 04:15 
Martin C. Martin21 Feb 2008 05:44 
Tom Nichols21 Feb 2008 06:22 
Smith, Jason, CTR, OASD(HA)/TMA21 Feb 2008 06:34 
Martin C. Martin21 Feb 2008 06:43 
Guillaume Laforge21 Feb 2008 06:48 
Guillaume Laforge21 Feb 2008 07:04 
Smith, Jason, CTR, OASD(HA)/TMA21 Feb 2008 07:18 
Charles Oliver Nutter21 Feb 2008 07:38 
Guillaume Laforge21 Feb 2008 07:42 
Martin C. Martin21 Feb 2008 08:36 
Martin C. Martin21 Feb 2008 08:48 
Pascal DeMilly21 Feb 2008 17:35 
Gavin Grover21 Feb 2008 18:21 
Jochen Theodorou22 Feb 2008 04:31 
Tom Nichols22 Feb 2008 04:49 
Charles Oliver Nutter22 Feb 2008 23:43 
Guillaume Laforge23 Feb 2008 00:28 
Martin C. Martin23 Feb 2008 03:51 
Jochen Theodorou23 Feb 2008 14:49 
Jochen Theodorou23 Feb 2008 14:53 
Charles Oliver Nutter24 Feb 2008 02:01 
Martin C. Martin24 Feb 2008 03:56 
Martin C. Martin24 Feb 2008 04:11 
Charles Oliver Nutter24 Feb 2008 05:12 
Jochen Theodorou24 Feb 2008 15:17 
Jochen Theodorou24 Feb 2008 15:31 
Alexandru Popescu ☀24 Feb 2008 15:36 
Martin C. Martin26 Feb 2008 14:20 
Martin C. Martin26 Feb 2008 15:15 
Jochen Theodorou27 Feb 2008 02:38 
Jochen Theodorou27 Feb 2008 03:03 
Martin C. Martin02 Mar 2008 17:21 
Subject:Re: [groovy-dev] Groovy performance: what to do
From:Alex Tkachman (alex@gmail.com)
Date:02/19/2008 12:48:54 PM
List:org.codehaus.groovy.dev

No, you are wrong.

Your code is equalent of Java

Object count () { Object a = 1 Object b = 1; return a + b; // compilation error }

On Feb 19, 2008 11:11 PM, Steven Devijver <stev@gmail.com> wrote:

On Feb 19, 2008 8:38 PM, Charles Oliver Nutter <char@sun.com> wrote:

Steven Devijver wrote:

On Feb 19, 2008 5:49 PM, Charles Oliver Nutter <char@sun.com> wrote:

Guillaume Laforge wrote:

However, as this has been discussed on this list a few times already or at the last Groovy Developer Conference, it's better and saner to make Groovy the fastest dynamic language possible on the JVM by creating the best second generation MOP, rather than by adding a few hacks to make Groovy a more statically typed language.

I agree with Guillaume. Such a change would end up making Groovy not only less dynamic and "less Groovy", it would also make it internally inconsistent since adding a static type declaration would change what method a call dispatches to.

Part of the problem with introducing static typing that produces static method binding is that much of Groovy's power comes from its ability to override methods on a target type. Since the outward-facing static-typed method signature does not do an additional dynamic dispatch, statically binding to either a Groovy type's or a Java type's static method signatures (as in Alex's experiment) would mean that additional changes (metaprogramming et al) would not be seen by static call sites.

So ultimately, you'd have dynamic invocation for dynamic (untyped) code and static invocation for static typed code, and mixing the two would lead to different pieces of code calling different methods.

I'm positive Groovy can do better in the performance arena while still remaining fully dynamic, and I have lots of ideas for how to get there I'm willing to share and help with. But I think the value of a dynamic-typed language is in dynamic typing...so we shouldn't optimize for static typing, especially when it changes the invocation semantics of the language.

Hmmm, as far as I can tell Alex's proposed changes have nothing to do with static typing.

That's how I interpreted these statements which talk about methods that are statically typed:

"The problem we try to solve can be formulated very simply - we have piece of code, which is effectlvely statically typed (either typed already or can become typed without to much problems for developer because he knows that nothing dynamic is involved) - we forget almost all we know about types during compilation because we assume that everything can be dynamicly changed at any momemt"

"Someone can argue that developer can always use Java, when he needs piece of statically typed code. There are several reasons why this is wrong - we seriously limit his freedom to develop - if he needs just 1 or 2 statically typed methods, why to add another Java class"

I think Alex can is best placed to comment on this. But what I understand is that Groovy code will be converted to byte code as is, without going through the MOP. Hence, you should be able to do:

@Typed def count() { def a = 1 def b = 1

a + b }

and get near-Java performance for executing the count() method (not calling it). Again, I can be mistaken but this is what I understand from what Alex said.

Steven

- Charlie

--------------------------------------------------------------------- To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

--------------------------------------------------------------------- To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

--------------------------------------------------------------------- To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email