tugwilson | 9 May 17:28
Picon
Favicon

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


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.

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,

John Wilson
--

-- 
View this message in context: http://www.nabble.com/dif-between-def-obj-%3D-new-MyObject%28%29-vs-MyObject-obj-%3D-new-MyObject%28%29-tp17031075p17150497.html
Sent from the groovy - user mailing list archive at Nabble.com.

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

    http://xircles.codehaus.org/manage_email


Gmane