Ed Clark | 9 May 17:48
Favicon

Re: [groovy-user] dif between def obj = new MyObject() vs MyObject obj = new MyObject()

tugwilson wrote:
>
> Ed Clark-2 wrote:
>   
>> Just curious - are there any performance benefits to specifying the
>> type, either compile time or run time?  I know that some languages
>> can speed things up if given some type hints.  (Given the extra
>> dynamic nature of Groovy, there may be none.)
>>
>>     
>
>
> Until very recently using static typing frequently made the program slower.
>   

Wow, I didn't expect that answer.  How recent is "very recently"?
is there a penalty in 1.5.6?  Was this due to things like extra type
checking on assignment?

> Now the Groovy runtime is getting faster it's likely that in future using
> static typing (especially if the type is a primitive) will make the program
> run faster. I have an experimental dynamic runtime which executes
> expressions almost twice as fast if the types of the variables are known and
> are primitive,
>
>   
Anything targeted to 1.6?  Just wondering whether to start being
more thorough in specifying types.  Although I had said that I
think it's a good idea to specify types, I'm also quite lazy ;-) and
tend to leave them off if there's no performance payoff (especially
if there's a penalty).

> John Wilson
>   

Ed Clark

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

    http://xircles.codehaus.org/manage_email


Gmane