31 messages in org.codehaus.groovy.devRe: [groovy-dev] as usual on performa...
FromSent OnAttachments
Alex TkachmanFeb 27, 2008 5:38 am 
Guillaume LaforgeFeb 27, 2008 5:47 am 
Alex TkachmanFeb 27, 2008 6:01 am 
Chanwit KaewkasiFeb 27, 2008 6:21 am 
Martin C. MartinFeb 27, 2008 6:27 am 
Jochen TheodorouFeb 27, 2008 6:32 am 
Jochen TheodorouFeb 27, 2008 6:33 am 
tugwilsonFeb 27, 2008 6:55 am 
Chanwit KaewkasiFeb 27, 2008 7:15 am 
Chanwit KaewkasiFeb 27, 2008 8:01 am 
Jochen TheodorouFeb 27, 2008 8:28 am 
tugwilsonFeb 27, 2008 9:00 am 
tugwilsonFeb 27, 2008 9:55 am 
Chanwit KaewkasiFeb 27, 2008 11:27 am 
Chanwit KaewkasiFeb 27, 2008 11:31 am 
Jochen TheodorouFeb 27, 2008 11:36 am 
Alex TkachmanFeb 27, 2008 11:58 am 
Martin C. MartinFeb 27, 2008 12:18 pm 
Jochen TheodorouFeb 27, 2008 12:37 pm 
Jochen TheodorouFeb 27, 2008 12:45 pm 
tugwilsonFeb 27, 2008 12:48 pm 
tugwilsonFeb 27, 2008 12:51 pm 
Martin C. MartinFeb 27, 2008 1:27 pm 
Alex TkachmanFeb 27, 2008 1:48 pm 
tugwilsonFeb 27, 2008 2:14 pm 
Jochen TheodorouFeb 27, 2008 5:09 pm 
Alexandru Popescu ☀Feb 27, 2008 5:38 pm 
Charles Oliver NutterFeb 28, 2008 12:20 am 
Jochen TheodorouFeb 28, 2008 1:33 am 
Alexandru Popescu ☀Feb 28, 2008 2:56 am 
tugwilsonFeb 28, 2008 3:29 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [groovy-dev] as usual on performance - operations on primitivesActions...
From:tugwilson (tu@wilson.co.uk)
Date:Feb 28, 2008 3:29:01 am
List:org.codehaus.groovy.dev

Alexandru Popescu ☀ wrote:

On Thu, Feb 28, 2008 at 11:33 AM, Jochen Theodorou <blac@gmx.org> wrote:

Alexandru Popescu ☀ schrieb: [...]

If a MetaClass is changed in another thread, when exactly needs the current thread respect this?

[...]

I think the change should follow (if possible) the Java Memory Model, and so affect concurrent threads if there are any happens-before elements available.

well, ok, but how does this answer the question? John, how does Ng behave here?

Well, I guess it answers your question :-), and here it is how: if one of the variables involved is declared as volatile then the change in metaclass should kick in right away. If there is no volatile involved (or synchronized field access) then the metaclass change may not be considered during the loop.

The issue is not the volatility of the variable it's the volatility of the behaviour of the value of the variable. Declaring a variable volatile is irrelevant.

However the behaviour of the object may be changed as a result of performing an operation on the object (because the MetaClass can change its behaviour as a result of an operation being performed via the MetaClass). That is to say that you don't just have to worry about another thread monkey patching the behaviour of Integer you have to worry about your own thread monkey patching the behaviour of Integer. So every time you make a method call you have to check to see if the behaviour is changed. However as everything goes via the MetaClass you are making a method call per operation so you *can't* assume that the behaviour of Integer is unchanged for the duration of an expression.

We're trying to run before we can walk.

There's a huge performance gain available by doing straightforward optimisation of the execution paths through the run time system. It's not productive to expend effort on questionable "optimisation" special cases when the general case can be vastly improved. You need to solve the general problem satisfactorily before addressing the special cases.

John Wilson

-- View this message in context:
http://www.nabble.com/as-usual-on-performance---operations-on-primitives-tp15713441p15734481.html Sent from the groovy - dev mailing list archive at Nabble.com.

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

http://xircles.codehaus.org/manage_email