jastrachan | 1 Feb 09:03 2005

Re: [groovy-dev] slow execution when using properties

On 1 Feb 2005, at 03:34, Marius Gleeson wrote:
> Hi there,
> I have a java class which I am assigning an instance to a variable
> called 'domain' in the shell.
> I am wondering why there is such a speed difference between these two
> lines of code,
> domain.getProfile().getHost().getPort()
> domain.profile.host.port
> The first line executes almost staight away, however the second takes
> about 3 or 4 seconds to return, which makes
> it pretty painfull to use.

That sounds strange; in both cases, we go through the MetaClass to 
invoke methods or properties, so this seems strange. I can't explain 
it! :)

We might need to get a profiler to run on your code to figure out where 
the delay is. Is it using lots of CPU or just waiting a while?