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:Jochen Theodorou (blac@gmx.org)
Date:Feb 27, 2008 6:32:08 am
List:org.codehaus.groovy.dev

Alex Tkachman schrieb:

No, infortunately it is not what I am looking for. This part (how operations done) is very clear and consistent and call sites already appretiate all this rules.

My questions are: What's going on when we declare field of primitive type? What is field type in compiled code?

it is the primitve type.

Same for Local variable?

no, atm most of the code in the compiler depends on having always boxed variables. This doesn't bite with the fields, as the conversion there happens only when the field is assigned. So if you do this.x=this.x+1, then first this.x gets boxed, then +1 is executed which will result in a boxed value and then unboxing will happen during the assignment...

I wanted to try to write somethings that tracks the boxing/unboxing actions and transforms the bytecode to remove the unneeded actions, but I had not yet time to look into this... also it would not help in the case I showed... not unless a method is created that can be (1) called directly and (2) use the primitve type. And with called directly I mean *no reflection*

Parameter?

parameters are primitive, but they are boxed as soon as the method is entered.

Return type?

primitive again, we unbox directly before the return.

How magical boxing/unboxing work

unboxing is done when needed, boxing is the standard. for example when you have a finally clauses, then it is more easy to handle a return with a value that is boxed and then unbox directly before the return. This way you have also no problem with the return type of an expression, which you might not really know. Also many calls to organize the operand stack do not need to know if the type is boxed or not.

I guess the first thing we would have to do is abstract the reorganization instruction we use and track the operand stack. then any such abstracted reorganization will look at the involved values in the operand stack and use bytecode depending on these. All in all there is not much of a problem as long as there are no longs and doubles involved. But if, then it gets complicated, because many bytecode operations behave different now, or even become invalid.

[...]

I don't want to say right now there are some problems in this area. What I say I would love to read clear description, which will help to understand.

I want to say, that if we could make it, so that we have a fast route in the code which calculates the values using the primitive types and operations, then we get much more speed in many arithmetic benchmarks.

[...]

P.S. Unfortunately 30-40% is much less than I expected :(

depends on what else you do I guess

bye blackdrag

-- Jochen "blackdrag" Theodorou The Groovy Project Tech Lead (http://groovy.codehaus.org) http://blackdragsview.blogspot.com/ http://www.g2one.com/

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

http://xircles.codehaus.org/manage_email