<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Groovy + Annotations + Aspects</title>
	<atom:link href="http://blog.secosoft.net/2007/07/20/groovy-annotations-aspects/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.secosoft.net/2007/07/20/groovy-annotations-aspects/</link>
	<description>Matt Secoske's intermittent ramblings on software and life</description>
	<pubDate>Fri, 05 Sep 2008 21:52:55 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: John Wilson</title>
		<link>http://blog.secosoft.net/2007/07/20/groovy-annotations-aspects/#comment-39153</link>
		<dc:creator>John Wilson</dc:creator>
		<pubDate>Sat, 21 Jul 2007 11:18:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.secosoft.net/2007/07/20/groovy-annotations-aspects/#comment-39153</guid>
		<description>Andres,

The performance hit is not in executing the use method.

The hit comes form the fact the whist you are executing the closure the way in which the MetaClass resolves calls is changed. So whist you have a category applies all your calls will be slower (this includes calls to objects which the Category has not touched).

In addition this performance hit is taken by all the threads in the JVM not just the thread which is applying the Category.

The current implementation makes the method calls about three times slower when a Category is applied.

There is no intrinsic reason why the run time system should impose this overhead and I would expect future versions of Groovy to reduce this overhead to virtually nothing (I have written a working MetaClass implementation for another dynamic language for the JVM which supports Categories and imposes a call overhead of less than 1% and that overhead is only incurred by the thread which uses the Category).</description>
		<content:encoded><![CDATA[<p>Andres,</p>
<p>The performance hit is not in executing the use method.</p>
<p>The hit comes form the fact the whist you are executing the closure the way in which the MetaClass resolves calls is changed. So whist you have a category applies all your calls will be slower (this includes calls to objects which the Category has not touched).</p>
<p>In addition this performance hit is taken by all the threads in the JVM not just the thread which is applying the Category.</p>
<p>The current implementation makes the method calls about three times slower when a Category is applied.</p>
<p>There is no intrinsic reason why the run time system should impose this overhead and I would expect future versions of Groovy to reduce this overhead to virtually nothing (I have written a working MetaClass implementation for another dynamic language for the JVM which supports Categories and imposes a call overhead of less than 1% and that overhead is only incurred by the thread which uses the Category).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andres Almiray</title>
		<link>http://blog.secosoft.net/2007/07/20/groovy-annotations-aspects/#comment-39088</link>
		<dc:creator>Andres Almiray</dc:creator>
		<pubDate>Sat, 21 Jul 2007 00:27:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.secosoft.net/2007/07/20/groovy-annotations-aspects/#comment-39088</guid>
		<description>Nice example Matt, but you also have to consider that multiple use() calls have a performance hit, specially if the code is run in more than one thread, as use() binds the new methods to a ThreadLocal variable.

If you suspect that a lot of calls to use() will be ensued the n it would be better to 'bootstrap' all your categories at once and enclose your code, this is the same approach groovlets have, as John previously commented too. Remember that you can declare more than one category with just one call to use() =)</description>
		<content:encoded><![CDATA[<p>Nice example Matt, but you also have to consider that multiple use() calls have a performance hit, specially if the code is run in more than one thread, as use() binds the new methods to a ThreadLocal variable.</p>
<p>If you suspect that a lot of calls to use() will be ensued the n it would be better to &#8216;bootstrap&#8217; all your categories at once and enclose your code, this is the same approach groovlets have, as John previously commented too. Remember that you can declare more than one category with just one call to use() =)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://blog.secosoft.net/2007/07/20/groovy-annotations-aspects/#comment-39024</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Fri, 20 Jul 2007 12:09:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.secosoft.net/2007/07/20/groovy-annotations-aspects/#comment-39024</guid>
		<description>Yes, it does take more code overall... there are times where I will take that hit versus readability.

I thought about putting the use code in a surrounding method, and it works ok.  That is until some other client tries to call the method containing the category code without a use block...  I wanted a way to guarantee that the method was inside a use block.

And, if nothing else, this can be treated as an example of how to use Groovy, annotations and aspects all together.</description>
		<content:encoded><![CDATA[<p>Yes, it does take more code overall&#8230; there are times where I will take that hit versus readability.</p>
<p>I thought about putting the use code in a surrounding method, and it works ok.  That is until some other client tries to call the method containing the category code without a use block&#8230;  I wanted a way to guarantee that the method was inside a use block.</p>
<p>And, if nothing else, this can be treated as an example of how to use Groovy, annotations and aspects all together.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Wilson</title>
		<link>http://blog.secosoft.net/2007/07/20/groovy-annotations-aspects/#comment-39012</link>
		<dc:creator>John Wilson</dc:creator>
		<pubDate>Fri, 20 Jul 2007 09:28:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.secosoft.net/2007/07/20/groovy-annotations-aspects/#comment-39012</guid>
		<description>Seems a huge amount of trouble to avoid typing:

use(MeasurementCategory) {
...
}

Your annotation takes more keystrokes than that!

If you don't want to put the use in your function you can just put it in your main function

static main(args) {
  use(MeasurementCategory) {
    new MyClass().start()
  }
}

categories are inherited by methods called from within the closure.</description>
		<content:encoded><![CDATA[<p>Seems a huge amount of trouble to avoid typing:</p>
<p>use(MeasurementCategory) {<br />
&#8230;<br />
}</p>
<p>Your annotation takes more keystrokes than that!</p>
<p>If you don&#8217;t want to put the use in your function you can just put it in your main function</p>
<p>static main(args) {<br />
  use(MeasurementCategory) {<br />
    new MyClass().start()<br />
  }<br />
}</p>
<p>categories are inherited by methods called from within the closure.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
