62 messages in org.codehaus.groovy.devRe: [groovy-dev] Groovy performance: ...| From | Sent On | Attachments |
|---|---|---|
| Alex Tkachman | 19 Feb 2008 02:09 | |
| Steven Devijver | 19 Feb 2008 02:37 | |
| Alexandru Popescu ☀ | 19 Feb 2008 02:57 | |
| Alex Tkachman | 19 Feb 2008 03:03 | |
| Patric Bechtel | 19 Feb 2008 03:12 | |
| Guillaume Laforge | 19 Feb 2008 03:25 | |
| Guillaume Laforge | 19 Feb 2008 03:26 | |
| Patric Bechtel | 19 Feb 2008 05:05 | |
| Gavin Grover | 19 Feb 2008 05:51 | |
| Steven Devijver | 19 Feb 2008 05:52 | |
| Guillaume Laforge | 19 Feb 2008 05:54 | |
| Tom Nichols | 19 Feb 2008 06:26 | |
| Alex Tkachman | 19 Feb 2008 06:28 | |
| Guillaume Laforge | 19 Feb 2008 06:35 | |
| Tom Nichols | 19 Feb 2008 07:03 | |
| Guillaume Laforge | 19 Feb 2008 07:38 | |
| Chanwit Kaewkasi | 19 Feb 2008 07:52 | |
| Charles Oliver Nutter | 19 Feb 2008 08:49 | |
| Steven Devijver | 19 Feb 2008 10:03 | |
| Charles Oliver Nutter | 19 Feb 2008 11:38 | |
| Steven Devijver | 19 Feb 2008 12:11 | |
| Alex Tkachman | 19 Feb 2008 12:39 | |
| Alex Tkachman | 19 Feb 2008 12:48 | |
| tugwilson | 19 Feb 2008 13:36 | |
| Alex Tkachman | 19 Feb 2008 20:51 | |
| Guillaume Laforge | 20 Feb 2008 02:10 | |
| Jochen Theodorou | 20 Feb 2008 09:46 | |
| Martin C. Martin | 20 Feb 2008 17:25 | |
| Guillaume Laforge | 21 Feb 2008 01:35 | |
| Tom Nichols | 21 Feb 2008 04:15 | |
| Martin C. Martin | 21 Feb 2008 05:44 | |
| Tom Nichols | 21 Feb 2008 06:22 | |
| Smith, Jason, CTR, OASD(HA)/TMA | 21 Feb 2008 06:34 | |
| Martin C. Martin | 21 Feb 2008 06:43 | |
| Guillaume Laforge | 21 Feb 2008 06:48 | |
| Guillaume Laforge | 21 Feb 2008 07:04 | |
| Smith, Jason, CTR, OASD(HA)/TMA | 21 Feb 2008 07:18 | |
| Charles Oliver Nutter | 21 Feb 2008 07:38 | |
| Guillaume Laforge | 21 Feb 2008 07:42 | |
| Martin C. Martin | 21 Feb 2008 08:36 | |
| Martin C. Martin | 21 Feb 2008 08:48 | |
| Pascal DeMilly | 21 Feb 2008 17:35 | |
| Gavin Grover | 21 Feb 2008 18:21 | |
| Jochen Theodorou | 22 Feb 2008 04:31 | |
| Tom Nichols | 22 Feb 2008 04:49 | |
| Charles Oliver Nutter | 22 Feb 2008 23:43 | |
| Guillaume Laforge | 23 Feb 2008 00:28 | |
| Martin C. Martin | 23 Feb 2008 03:51 | |
| Jochen Theodorou | 23 Feb 2008 14:49 | |
| Jochen Theodorou | 23 Feb 2008 14:53 | |
| Charles Oliver Nutter | 24 Feb 2008 02:01 | |
| Martin C. Martin | 24 Feb 2008 03:56 | |
| Martin C. Martin | 24 Feb 2008 04:11 | |
| Charles Oliver Nutter | 24 Feb 2008 05:12 | |
| Jochen Theodorou | 24 Feb 2008 15:17 | |
| Jochen Theodorou | 24 Feb 2008 15:31 | |
| Alexandru Popescu ☀ | 24 Feb 2008 15:36 | |
| Martin C. Martin | 26 Feb 2008 14:20 | |
| Martin C. Martin | 26 Feb 2008 15:15 | |
| Jochen Theodorou | 27 Feb 2008 02:38 | |
| Jochen Theodorou | 27 Feb 2008 03:03 | |
| Martin C. Martin | 02 Mar 2008 17:21 |
| Subject: | Re: [groovy-dev] Groovy performance: what to do![]() |
|---|---|
| From: | Martin C. Martin (mar...@martincmartin.com) |
| Date: | 02/20/2008 05:25:38 PM |
| List: | org.codehaus.groovy.dev |
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.
What would happen if such a proposal was committed? In a few months from now, all Groovy code samples we would come across would be littered with @Typed annotations all around -- who remembers the ugly @Property annotation making your Groovy beans ugly?
True, although it could be changed to a keyword. "static" is already taken in Java (and C and C++) to mean something else, but we could think of another keyword, e.g. "typed."
A few months later, and people will wonder why this is not the default behavior and be applied to all possible methods or classes. Groovy will become more and more statically typed, and for "performance sake", we'd imagine other such hacks to make Groovy less and less dynamic over time, or littered with ugly annotations.
I'm surprised you're so sure how people would use this particular feature. I work with the one language I know of that has optional typing for efficiency: Lisp. In our code base, it's not used too much, because (a) most people worry about getting the job done, and only focus on performance when it becomes a problem, and (b) it tends to clutter up the code, and people don't want to clutter up the code for no good reason. It seems a strong possibility that this would turns out the same way in Groovy. However, it's also possible things will turn out the way you say.
But, I'm not sure it's such a bad thing. People tend to assume things are static, and are surprised by the (possibility of) the dynamic nature. For example, people are often surprised that mylist.size() can't be compiled to mylist.length. They're even more surprised that when used in a loop, that it isn't resolved just the first time through but every time through.
Such a proposal would be a consent that we failed to make Groovy the fastest dynamic language possible. Have we really tried to make Groovy as fast as possible? Have we implemented a second generation MOP yet? No.
I'm worried that this will end up turning into a Sufficiently Smart Compiler, something that's so hard to do right that it never happens:
http://c2.com/cgi/wiki?SufficientlySmartCompiler
Furthermore, even with such an annotation, this code path would always be slower than raw Java anyway.
True, but it would often be "fast enough." If Groovy is, say, 10 to 20 times slower than Java, and by sprinkling a few keywords or annotations around you can get it 2 times slower, that will often be good enough, and there'll be no reason to rewrite it in Java.
Remember that Groovy has not been conceived to replace Java, but as a complement, an adjunct, an enhancer to Java. It's a core value of the language and the project. With the joint compiler, the ant tasks, the maven plugin, it's so easy to just implement one additional Java class, that it is totally seamless and transparent to mix Groovy and Java together.
When raw performance matter, using Java is simply the best option, and nothing we could do would make the code faster than raw Java.
Actually, that's not true. The main product of the company I work for is a search engine for air fares. It's used by some of the main travel sites in the U.S. (Orbitz.com and Kayak.com), and by most big U.S. airlines. It's very performance intensive code; whenever you do a search, it takes many seconds to find the answer, and that's one of the biggest complaints. Yet it's not written in C/C++ or any other statically typed language. It's written in Lisp.
Why? Because its complex algorithmic code, and it would be several times longer in a statically typed language. It would be even harder to understand. There's no single bottleneck, there are around 20 stages, and depending on the query each of them can take a significant amount of time.
So, I think it's a shame that Groovy can't replace Java, and I really don't see why it couldn't.
It doesn't mean that Groovy can't be made more performant than it is today, on the contrary, it's time to work on MOP2 instead. So you can focus your energy on something less frustrating if you so wish.
As discussed several times already, we should focus now on this new Meta-Object Protocol, perhaps to make Groovy even more dynamic, but to make it the faster possible dynamic language across all possible platforms -- it's not an unrealistic goal to be faster than Ruby and Python.
Faster than Ruby and Python is realistic without compiler hints, but it seems that significantly faster than that is relatively easy to do.
I wonder: how often are the more extreme dynamic aspects of Groovy, or any dynamic language, actually used? How often is a meta object protocol (other than default ones) actually used? How often are per-instance MOPs used? How often are the changed at runtime?
--------------------------------------------------------------------- To unsubscribe from this list, please visit:




